Bug: wrong code gen. for indices with comparisons
In function 'luaK_exp2val', used to generate code for indices: Macro 'hasjumps' does not consider the case when the whole expression is a "jump" (a test). In all other of its uses, the surrounding code ensures that the expression cannot be VJMP.
This commit is contained in:
3
lcode.c
3
lcode.c
@@ -31,6 +31,7 @@
|
||||
#include "lvm.h"
|
||||
|
||||
|
||||
/* (note that expressions VJMP also have jumps.) */
|
||||
#define hasjumps(e) ((e)->t != (e)->f)
|
||||
|
||||
|
||||
@@ -991,7 +992,7 @@ void luaK_exp2anyregup (FuncState *fs, expdesc *e) {
|
||||
** or it is a constant.
|
||||
*/
|
||||
void luaK_exp2val (FuncState *fs, expdesc *e) {
|
||||
if (hasjumps(e))
|
||||
if (e->k == VJMP || hasjumps(e))
|
||||
luaK_exp2anyreg(fs, e);
|
||||
else
|
||||
luaK_dischargevars(fs, e);
|
||||
|
||||
Reference in New Issue
Block a user