From 88edd7366e3d32a336b4066d7ba17104bc09e10f Mon Sep 17 00:00:00 2001 From: Jeff Bezanson Date: Sun, 18 Mar 2012 22:57:23 -0400 Subject: [PATCH] might fix #602 --- src/alloc.c | 5 +++-- src/builtins.c | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/alloc.c b/src/alloc.c index 67f9d06eed12a..0227d723e4aa3 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -585,8 +585,9 @@ BOX_FUNC(float64, double, jl_box, 3) static jl_value_t *boxed_##typ##_cache[NBOX_C]; \ jl_value_t *jl_box_##typ(c_type x) \ { \ - if ((u##c_type)(x+NBOX_C/2) < NBOX_C) \ - return boxed_##typ##_cache[(x+NBOX_C/2)]; \ + c_type idx = x+NBOX_C/2; \ + if ((u##c_type)idx < (u##c_type)NBOX_C) \ + return boxed_##typ##_cache[idx]; \ jl_value_t *v = alloc_##nw##w(); \ v->type = (jl_type_t*)jl_##typ##_type; \ *(c_type*)jl_bits_data(v) = x; \ diff --git a/src/builtins.c b/src/builtins.c index c45c808249e17..489951778e93d 100644 --- a/src/builtins.c +++ b/src/builtins.c @@ -280,6 +280,8 @@ static int is_intrinsic(jl_sym_t *s) static int has_intrinsics(jl_expr_t *e) { + if (e->args->length == 0) + return 0; jl_value_t *e0 = jl_exprarg(e,0); if (e->head == call_sym && ((jl_is_symbol(e0) && is_intrinsic((jl_sym_t*)e0)) || @@ -298,6 +300,7 @@ static int has_intrinsics(jl_expr_t *e) // the compiler or the interpreter. static int eval_with_compiler_p(jl_expr_t *expr, int compileloops) { + assert(jl_is_expr(expr)); if (expr->head==body_sym) { jl_array_t *body = expr->args; size_t i;