lex pops
2014-08-21 00:02:44 UTC
Tried this on latest git repo. Running without -jdump always returns
101 for this code:
-----
local ffi = require("ffi")
ffi.cdef('struct box {double value;}')
local doublebox = ffi.typeof('struct box')
local arr = ffi.new('struct box *[1]')
arr[0] = doublebox(1)
for i=1,100 do
arr[0].value = arr[0].value + 1
end
print(arr[0].value)
-----
However running with -jdump produces varying bogus output ('nil',
'dispatchmap', 'stop', segfault, 43, etc.)
Using an array of struct (instead of struct *) fixes the issue. I'm
not 100% sure, but I assume my code is well defined because without
jdump it is consistent and correct.
~Lex
101 for this code:
-----
local ffi = require("ffi")
ffi.cdef('struct box {double value;}')
local doublebox = ffi.typeof('struct box')
local arr = ffi.new('struct box *[1]')
arr[0] = doublebox(1)
for i=1,100 do
arr[0].value = arr[0].value + 1
end
print(arr[0].value)
-----
However running with -jdump produces varying bogus output ('nil',
'dispatchmap', 'stop', segfault, 43, etc.)
Using an array of struct (instead of struct *) fixes the issue. I'm
not 100% sure, but I assume my code is well defined because without
jdump it is consistent and correct.
~Lex