]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
Fix FOLD rule for string.sub(s, ...) == k.
authorMike Pall <mike>
Tue, 20 May 2014 09:41:32 +0000 (11:41 +0200)
committerMike Pall <mike>
Tue, 20 May 2014 09:41:32 +0000 (11:41 +0200)
src/lj_opt_fold.c

index 409549c9892fe5ab3405f16d3f0620be42f8b753..a15f927c445833e261693453d08d07460059b24f 100644 (file)
@@ -1826,7 +1826,8 @@ LJFOLDF(merge_eqne_snew_kgc)
   if (len <= FOLD_SNEW_MAX_LEN) {
     IROp op = (IROp)fins->o;
     IRRef strref = fleft->op1;
-    lua_assert(IR(strref)->o == IR_STRREF);
+    if (IR(strref)->o != IR_STRREF)
+      return NEXTFOLD;
     if (op == IR_EQ) {
       emitir(IRTGI(IR_EQ), fleft->op2, lj_ir_kint(J, len));
       /* Caveat: fins/fleft/fright is no longer valid after emitir. */