[LLVMdev] Invalid or unaligned stack
Dibyendu Majumdar
mobile at majumdar.org.uk
Mon Mar 30 15:59:19 PDT 2015
Hi,
I am encountering a problem that I do not know how to debug. I would
greatly appreciate any guidance on this issue.
On Windows when I run Lua test cases from JITed code I am getting
following error:
Unhandled exception at 0x00007FFCEEEAC500 (ntdll.dll) in lua.exe:
0xC0000028: An invalid or unaligned stack was encountered during an
unwind operation.
This is happening when the Lua code is attempting to call longjmp().
The Lua test case that triggers this is a recursive call as shown below.
function err_on_n (n)
if n==0 then error(); exit(1);
else err_on_n (n-1); exit(1);
end
end
do
function dummy (n)
if n > 0 then
assert(not pcall(err_on_n, n))
dummy(n-1)
end
end
end
dummy(10)
I have a struct that is created on the stack in the JIT compiler, and
this error is triggered when I add a field to the struct - if I remove
the field the error stops. The struct is not very large in size - it
is only 392 bytes with the new field.
If I allocate this struct on the heap the error goes away.
Note that just adding the field triggers the error even if I have no
other code changes.
The error occurs in Release build but not in Debug build.
I am using Visual C++ 2013 - 64-bit, and LLVM 3.6.0 on Windows.
I see no other unexpected behaviour - all the other tests pass.
All tests pass on Ubuntu, using LLVM 3.5.1 and gcc 4.8.2.
Of course I am currently assuming that somewhere my program is
corrupting memory - but as I have no other signs of a memory
corruption - the issue may be something else.
Any tips on what the problem might be would be gratefully received.
Thanks and Regards
Dibyendu
More information about the llvm-dev
mailing list