Closed shoe42 closed 2 years ago
I suspect this is a LuaJIT bug.
Can you please help me with this test?
bug604.c
:
#include <stdint.h>
int8_t f(int8_t x0, int8_t x1, int8_t x2, int8_t x3, int8_t x4, int8_t x5, int8_t x6, int8_t x7, int8_t x8, int8_t x9) {
return x0 + x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9;
}
bug604.t
:
local c = terralib.includecstring [[
#include <stdint.h>
int8_t f(int8_t x0, int8_t x1, int8_t x2, int8_t x3, int8_t x4, int8_t x5, int8_t x6, int8_t x7, int8_t x8, int8_t x9);
]]
terralib.linklibrary("libbug604.dylib")
print(c.f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
bug604.lua
:
local ffi = require("ffi")
ffi.cdef [[
int8_t f(int8_t x0, int8_t x1, int8_t x2, int8_t x3, int8_t x4, int8_t x5, int8_t x6, int8_t x7, int8_t x8, int8_t x9);
]]
local c = ffi.load("libbug604")
print(c.f(0, 1, 2, 3, 4, 5, 6, 7, 8, 9))
Then run:
clang bug604.c -o libbug604.dylib -shared -Wall
./build/bin/terra bug604.t
./build/bin/terra bug604.lua
It should print 45
with each of the last two commands, but I suspect it will fail with both.
Looks like it's still failing:
$ ../build/bin/terra bug604.t
bug604.t:9: NYI: cannot call this C function (yet)
stack traceback:
[C]: in function 'f'
bug604.t:9: in main chunk
$ ../build/bin/terra bug604.lua
bug604.lua:9: NYI: cannot call this C function (yet)
stack traceback:
[C]: in function 'f'
bug604.lua:9: in main chunk
Ok, definitely a LuaJIT bug. I'll file an issue shortly. It might help to have:
uname -a
clang --version
)Version info:
uname -a
: Darwin localhost 21.6.0 Darwin Kernel Version 21.6.0: Wed Aug 10 14:28:35 PDT 2022; root:xnu-8020.141.5~2/RELEASE_ARM64_T8101 arm64Upstream issue submitted: https://github.com/LuaJIT/LuaJIT/issues/888
The upstream issue was closed as a duplicate of https://github.com/LuaJIT/LuaJIT/issues/205, which has been open for six years with no indication of being a priority. I think at this point the best we can do is modify the bounds on this test so that we stick to what works.
@shoe42 Is this still failing? What does the output look like on master
now?
Looks like on commit 71f2180cbf252f615c1fb7b2d7dd0746581b0741, the test fails with:
$ ../build/bin/terra cconv_array.t
running test for int8[0]
running test for int8[1]
running test for int8[2]
running test for int8[3]
running test for int8[4]
running test for int8[5]
running test for int8[6]
running test for int8[7]
running test for int8[8]
running test for int16[0]
running test for int16[1]
running test for int16[2]
running test for int16[3]
running test for int16[4]
running test for int16[5]
running test for int16[6]
running test for int16[7]
running test for int16[8]
running test for int16[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
[C]: in function 'caller'
cconv_array.t:53: in function 'run_test_case'
cconv_array.t:74: in main chunk
Sigh. Ok, if you take out int16
for a moment, does it fail on int32
too? I can work around this but would like to know what types I'll need to do so for.
int32
:
running test for int32[0]
running test for int32[1]
running test for int32[2]
running test for int32[3]
running test for int32[4]
running test for int32[5]
running test for int32[6]
running test for int32[7]
running test for int32[8]
running test for int32[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
[C]: in function 'caller'
cconv_array.t:53: in function 'run_test_case'
cconv_array.t:74: in main chunk
float
:
running test for float[0]
running test for float[1]
running test for float[2]
running test for float[3]
running test for float[4]
running test for float[5]
running test for float[6]
running test for float[7]
running test for float[8]
running test for float[9]
cconv_array.t:53: NYI: cannot call this C function (yet)
stack traceback:
[C]: in function 'caller'
cconv_array.t:53: in function 'run_test_case'
cconv_array.t:74: in main chunk
int64
and double
seem to all pass.
Thanks. I'll make a new workaround.
Can you try running the version of cconv_array.t
in #611 and let me know if it works this time?
Yup, looks like that PR makes cconv_array.t
pass tests now.
Thanks! Merged. I think all tests should pass in master
now.
@shoe42 if you'd like to do one last check, I can get a release rolling.
Looks like everything is passing successfully - thanks for the work in bringing M1 test pass rate up to scratch!
Thanks, will release here shortly.
Just FYI: as of #642 I have pulled in an updated LuaJIT that fixes the root cause, and with that, we can now run the full cconv_array.t
test again.
The
cconv_array.t
test fails on macOS arm64 (M1). macOS 12.5, using system clang and Homebrew LLVM 13. Trimmed output: