changeset 15240:a38d5ed5b3d8

dot.cc: Segfault with integers (bug #37199)
author Max Brister <max@2bass.com>
date Sun, 26 Aug 2012 20:06:19 -0600
parents c4779a180134
children a23693fa5ba9
files libinterp/corefcn/dot.cc
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/dot.cc
+++ b/libinterp/corefcn/dot.cc
@@ -215,7 +215,7 @@
                 {
                   // Non-optimized evaluation.
                   octave_value_list tmp;
-                  tmp(1) = args(2);
+                  tmp(1) = dim + 1;
                   tmp(0) = do_binary_op (octave_value::op_el_mul, argx, argy);
                   if (! error_state)
                     {
@@ -247,6 +247,19 @@
 %!test
 %! x = [1+i, 3-i; 1-i, 3-i];
 %! assert (dot (x, x), [4, 20]);
+
+%!test
+%! x = int8 ([1 2]);
+%! y = int8 ([2 3]);
+%! assert (dot (x, y), 8);
+
+%!test
+%! x = int8 ([1 2; 3 4]);
+%! y = int8 ([5 6; 7 8]);
+%! assert (dot (x, y), [26 44]);
+%! assert (dot (x, y, 2), [17; 53]);
+%! assert (dot (x, y, 3), [5 12; 21 32]);
+
 */
 
 DEFUN (blkmm, args, ,