]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix ABC FOLD rule with constants.
authorMike Pall <mike>
Thu, 13 Jan 2022 13:40:11 +0000 (14:40 +0100)
committerMike Pall <mike>
Thu, 13 Jan 2022 13:40:11 +0000 (14:40 +0100)
Reported by XmiliaH.

src/lj_opt_fold.c

index 6bb3fc59b8ce6aeeb09f831c300849e0cee5ff58..1723af606d7b7b994659f51144c0b9d13e567244 100644 (file)
@@ -1682,14 +1682,15 @@ LJFOLDF(abc_fwd)
 LJFOLD(ABC any KINT)
 LJFOLDF(abc_k)
 {
+  PHIBARRIER(fleft);
   if (LJ_LIKELY(J->flags & JIT_F_OPT_ABC)) {
     IRRef ref = J->chain[IR_ABC];
     IRRef asize = fins->op1;
     while (ref > asize) {
       IRIns *ir = IR(ref);
       if (ir->op1 == asize && irref_isk(ir->op2)) {
-       int32_t k = IR(ir->op2)->i;
-       if (fright->i > k)
+       uint32_t k = (uint32_t)IR(ir->op2)->i;
+       if ((uint32_t)fright->i > k)
          ir->op2 = fins->op2;
        return DROPFOLD;
       }