changeset 15312:de9bfcf637df

Fix error when compiling with complex matrix (bug #37247) * jit-typeinfo.cc (jit_typeinfo::do_type_of): Correctly check for complex matricies. * pt-jit.cc (jit_convert::visit_constant): Correctly check for complex values.
author Max Brister <max@2bass.com>
date Thu, 06 Sep 2012 02:19:09 -0600
parents b055fc077224
children 67ef63ead023
files libinterp/interp-core/jit-typeinfo.cc libinterp/interp-core/pt-jit.cc
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interp-core/jit-typeinfo.cc
+++ b/libinterp/interp-core/jit-typeinfo.cc
@@ -2198,7 +2198,7 @@
   if (ov.is_range ())
     return get_range ();
 
-  if (ov.is_double_type ())
+  if (ov.is_double_type () && ! ov.is_complex_type ())
     {
       if (ov.is_real_scalar ())
         return get_scalar ();
--- a/libinterp/interp-core/pt-jit.cc
+++ b/libinterp/interp-core/pt-jit.cc
@@ -489,7 +489,7 @@
 jit_convert::visit_constant (tree_constant& tc)
 {
   octave_value v = tc.rvalue1 ();
-  if (v.is_real_scalar () && v.is_double_type ())
+  if (v.is_real_scalar () && v.is_double_type () && ! v.is_complex_type ())
     {
       double dv = v.double_value ();
       result = factory.create<jit_const_scalar> (dv);
@@ -2099,4 +2099,13 @@
 %! assert (a, 2000);
 %! assert (b, 1);
 
+%!test
+%! a = [1+1i 1+2i];
+%! b = 0;
+%! while 1
+%!   b = a(1);
+%!   break;
+%! endwhile
+%! assert (b, a(1));
+
 */