changeset 14811:711e64a11d36

Fix some segfaults
author Max Brister <max@2bass.com>
date Fri, 15 Jun 2012 13:15:48 -0500
parents e3696f2c6da6
children 2871d5f8d922
files src/pt-jit.cc
diffstat 1 files changed, 4 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/src/pt-jit.cc
+++ b/src/pt-jit.cc
@@ -55,7 +55,6 @@
 #include "ov-usr-fcn.h"
 #include "ov-scalar.h"
 #include "pt-all.h"
-#include "xpow.h"
 
 static llvm::IRBuilder<> builder (llvm::getGlobalContext ());
 
@@ -206,15 +205,6 @@
     }
 }
 
-extern "C" octave_base_value *
-octave_jit_xpow (double a, double b)
-{
-  octave_value ret = xpow (a, b);
-  octave_base_value *obv = ret.internal_rep ();
-  obv->grab ();
-  return obv;
-}
-
 extern "C" void
 octave_jit_ginvalid_index (void)
 {
@@ -540,15 +530,6 @@
   add_binary_fcmp (scalar, octave_value::op_gt, llvm::CmpInst::FCMP_UGT);
   add_binary_fcmp (scalar, octave_value::op_ne, llvm::CmpInst::FCMP_UNE);
 
-  llvm::Function *jxpow = create_function ("octave_jit_xpow", any, scalar,
-                                           scalar);
-  engine->addGlobalMapping (jxpow, reinterpret_cast<void *> (&octave_jit_xpow));
-  {
-    jit_function::overload ol (jxpow, false, any, scalar, scalar);
-    binary_ops[octave_value::op_pow].add_overload (ol);
-    binary_ops[octave_value::op_el_pow].add_overload (ol);
-  }
-
   llvm::Function *gripe_div0 = create_function ("gripe_divide_by_zero", void_t);
   engine->addGlobalMapping (gripe_div0,
                             reinterpret_cast<void *> (&gripe_divide_by_zero));
@@ -1930,7 +1911,7 @@
     fail ("Bad number of arguments in tree_index_expression");
 
   tree_argument_list *arg_list = args.front ();
-  if (arg_list->size () != 1)
+  if (arg_list && arg_list->size () != 1)
     fail ("Bad number of arguments in arg_list");
 
   tree_expression *tree_object = exp.expression ();
@@ -2030,6 +2011,9 @@
 void
 jit_convert::visit_simple_assignment (tree_simple_assignment& tsa)
 {
+  if (tsa.op_type () != octave_value::op_asn_eq)
+    fail ("Unsupported assign");
+
   // resolve rhs
   tree_expression *rhs = tsa.right_hand_side ();
   jit_value *rhsv = visit (rhs);