Skip to content

Commit 88edd73

Browse files
committed
might fix #602
1 parent baac6f2 commit 88edd73

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/alloc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,8 +585,9 @@ BOX_FUNC(float64, double, jl_box, 3)
585585
static jl_value_t *boxed_##typ##_cache[NBOX_C]; \
586586
jl_value_t *jl_box_##typ(c_type x) \
587587
{ \
588-
if ((u##c_type)(x+NBOX_C/2) < NBOX_C) \
589-
return boxed_##typ##_cache[(x+NBOX_C/2)]; \
588+
c_type idx = x+NBOX_C/2; \
589+
if ((u##c_type)idx < (u##c_type)NBOX_C) \
590+
return boxed_##typ##_cache[idx]; \
590591
jl_value_t *v = alloc_##nw##w(); \
591592
v->type = (jl_type_t*)jl_##typ##_type; \
592593
*(c_type*)jl_bits_data(v) = x; \

src/builtins.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,8 @@ static int is_intrinsic(jl_sym_t *s)
280280

281281
static int has_intrinsics(jl_expr_t *e)
282282
{
283+
if (e->args->length == 0)
284+
return 0;
283285
jl_value_t *e0 = jl_exprarg(e,0);
284286
if (e->head == call_sym &&
285287
((jl_is_symbol(e0) && is_intrinsic((jl_sym_t*)e0)) ||
@@ -298,6 +300,7 @@ static int has_intrinsics(jl_expr_t *e)
298300
// the compiler or the interpreter.
299301
static int eval_with_compiler_p(jl_expr_t *expr, int compileloops)
300302
{
303+
assert(jl_is_expr(expr));
301304
if (expr->head==body_sym) {
302305
jl_array_t *body = expr->args;
303306
size_t i;

0 commit comments

Comments
 (0)