diff --git a/src/lj_record.c b/src/lj_record.c index 6c64c645..8a123a61 100644 --- a/src/lj_record.c +++ b/src/lj_record.c @@ -527,9 +527,9 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl) TRef stop; IRType t; /* Avoid semantic mismatches and always failing guards. */ - if (tvisnan(&tv[FORL_IDX]) || - tvisnan(&tv[FORL_STOP]) || - tvisnan(&tv[FORL_STEP]) || + if ((tvisnum(&tv[FORL_IDX]) && tvisnan(&tv[FORL_IDX])) || + (tvisnum(&tv[FORL_STOP]) && tvisnan(&tv[FORL_STOP])) || + (tvisnum(&tv[FORL_STEP]) && tvisnan(&tv[FORL_STEP])) || tvismzero(&tv[FORL_STEP])) lj_trace_err(J, LJ_TRERR_GFAIL); if (isforl) { /* Handle FORL/JFORL opcodes. */