From e15765186c9e6a02cea1479e91ca6b02a23d8677 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Tue, 20 May 2014 11:41:32 +0200 Subject: [PATCH] Fix FOLD rule for string.sub(s, ...) == k. --- src/lj_opt_fold.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lj_opt_fold.c b/src/lj_opt_fold.c index 409549c9..a15f927c 100644 --- a/src/lj_opt_fold.c +++ b/src/lj_opt_fold.c @@ -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. */