Created
June 8, 2015 18:40
-
-
Save mpeterv/2362928a80d2b92cb17c to your computer and use it in GitHub Desktop.
luajit 2.1.0 testcase
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| -- The following code should print "nil" several times, | |
| -- but one of the nils gets replaced with a table somehow. | |
| local function key(expr) | |
| if type(expr) == 'table' then | |
| -- Removing the zero removes spurious table | |
| local res = {0} | |
| for i=1, #expr do | |
| res[i] = key(expr[i]) | |
| -- Uncommenting the following line removes spurious table | |
| -- io.stdout:write() | |
| end | |
| -- This unexpectedly prints "table: 0xaddress" once | |
| print(res[2]) | |
| end | |
| return | |
| end | |
| -- Turning jit off removes spurious table | |
| -- jit.off() | |
| key { 0, | |
| { 0, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, | |
| { 0, 0, 0 }, | |
| 0 }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, 0 }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| 0 }, | |
| 0 }, | |
| { 0 } | |
| }, | |
| 0 }, | |
| { 0 } | |
| }, | |
| 0 }, | |
| { 0 }, | |
| { 0, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, | |
| { 0, 0, 0 }, | |
| 0 }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, 0, | |
| { 0, 0, 0 } | |
| }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| 0 }, | |
| 0 }, | |
| { 0 } | |
| }, | |
| 0 }, | |
| { 0 } | |
| }, | |
| 0 }, | |
| { 0, | |
| { 0, 0, 0 }, | |
| { 0, | |
| { 0, 0 }, | |
| { 0, | |
| { 0, | |
| { 0, 0, | |
| { 0, 0, 0 } | |
| } | |
| } | |
| } | |
| }, | |
| 0 } | |
| } | |
| }, | |
| { } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment