diff options
-rw-r--r-- | lvm.c | 4 | ||||
-rw-r--r-- | testes/errors.lua | 8 |
2 files changed, 12 insertions, 0 deletions
@@ -1410,6 +1410,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1410 | vmbreak; | 1410 | vmbreak; |
1411 | } | 1411 | } |
1412 | vmcase(OP_MODK) { | 1412 | vmcase(OP_MODK) { |
1413 | savestate(L, ci); /* in case of division by 0 */ | ||
1413 | op_arithK(L, luaV_mod, luaV_modf); | 1414 | op_arithK(L, luaV_mod, luaV_modf); |
1414 | vmbreak; | 1415 | vmbreak; |
1415 | } | 1416 | } |
@@ -1422,6 +1423,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1422 | vmbreak; | 1423 | vmbreak; |
1423 | } | 1424 | } |
1424 | vmcase(OP_IDIVK) { | 1425 | vmcase(OP_IDIVK) { |
1426 | savestate(L, ci); /* in case of division by 0 */ | ||
1425 | op_arithK(L, luaV_idiv, luai_numidiv); | 1427 | op_arithK(L, luaV_idiv, luai_numidiv); |
1426 | vmbreak; | 1428 | vmbreak; |
1427 | } | 1429 | } |
@@ -1470,6 +1472,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1470 | vmbreak; | 1472 | vmbreak; |
1471 | } | 1473 | } |
1472 | vmcase(OP_MOD) { | 1474 | vmcase(OP_MOD) { |
1475 | savestate(L, ci); /* in case of division by 0 */ | ||
1473 | op_arith(L, luaV_mod, luaV_modf); | 1476 | op_arith(L, luaV_mod, luaV_modf); |
1474 | vmbreak; | 1477 | vmbreak; |
1475 | } | 1478 | } |
@@ -1482,6 +1485,7 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1482 | vmbreak; | 1485 | vmbreak; |
1483 | } | 1486 | } |
1484 | vmcase(OP_IDIV) { /* floor division */ | 1487 | vmcase(OP_IDIV) { /* floor division */ |
1488 | savestate(L, ci); /* in case of division by 0 */ | ||
1485 | op_arith(L, luaV_idiv, luai_numidiv); | 1489 | op_arith(L, luaV_idiv, luai_numidiv); |
1486 | vmbreak; | 1490 | vmbreak; |
1487 | } | 1491 | } |
diff --git a/testes/errors.lua b/testes/errors.lua index cf0ab526..bf6f389d 100644 --- a/testes/errors.lua +++ b/testes/errors.lua | |||
@@ -444,6 +444,14 @@ if not b then | |||
444 | end | 444 | end |
445 | end]], 5) | 445 | end]], 5) |
446 | 446 | ||
447 | |||
448 | -- bug in 5.4.0 | ||
449 | lineerror([[ | ||
450 | local a = 0 | ||
451 | local b = 1 | ||
452 | local c = b % a | ||
453 | ]], 3) | ||
454 | |||
447 | do | 455 | do |
448 | -- Force a negative estimate for base line. Error in instruction 2 | 456 | -- Force a negative estimate for base line. Error in instruction 2 |
449 | -- (after VARARGPREP, GETGLOBAL), with first absolute line information | 457 | -- (after VARARGPREP, GETGLOBAL), with first absolute line information |