aboutsummaryrefslogtreecommitdiff
path: root/testes
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-02-25 13:39:36 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2021-02-25 13:39:36 -0300
commite0260eb2d4085723302d637dd8f3fca339d18817 (patch)
treeb9cf6cdaf3c5b3a51c16ef0cf9bb46564e5ce807 /testes
parent5205f073c57ae4b69e90d35c02e3a1a1cca44eb4 (diff)
downloadlua-e0260eb2d4085723302d637dd8f3fca339d18817.tar.gz
lua-e0260eb2d4085723302d637dd8f3fca339d18817.tar.bz2
lua-e0260eb2d4085723302d637dd8f3fca339d18817.zip
Bug (kind of) in 'isinstack'
The function 'isinstack' tried to work around the undefined behavior of subtracting two pointers that do not point to the same object, but the compiler killed to trick. (It optimizes out the safety check, because in a correct execution it will be always true.)
Diffstat (limited to 'testes')
-rw-r--r--testes/errors.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/testes/errors.lua b/testes/errors.lua
index 4249f570..fd02806e 100644
--- a/testes/errors.lua
+++ b/testes/errors.lua
@@ -191,6 +191,13 @@ checkmessage("a = 24 // 0", "divide by zero")
191checkmessage("a = 1 % 0", "'n%0'") 191checkmessage("a = 1 % 0", "'n%0'")
192 192
193 193
194-- type error for an object which is neither in an upvalue nor a register.
195-- The following code will try to index the value 10 that is stored in
196-- the metatable, without moving it to a register.
197checkmessage("local a = setmetatable({}, {__index = 10}).x",
198 "attempt to index a number value")
199
200
194-- numeric for loops 201-- numeric for loops
195checkmessage("for i = {}, 10 do end", "table") 202checkmessage("for i = {}, 10 do end", "table")
196checkmessage("for i = io.stdin, 10 do end", "FILE") 203checkmessage("for i = io.stdin, 10 do end", "FILE")