# HG changeset patch # User Max Brister # Date 1339784148 18000 # Node ID 711e64a11d36db0006f561afd275eaa4a2ce5a88 # Parent e3696f2c6da69d2d6e0eddfa98869dc787b0d623 Fix some segfaults diff --git a/src/pt-jit.cc b/src/pt-jit.cc --- 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 (&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 (&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);