<div dir="ltr">See r227426 from Clang. setjmp on Win64 is really weird. There is a hidden second parameter that you may need to fill in with @llvm.frameaddress.</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Mar 30, 2015 at 3:59 PM, Dibyendu Majumdar <span dir="ltr"><<a href="mailto:mobile@majumdar.org.uk" target="_blank">mobile@majumdar.org.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I am encountering a problem that I do not know how to debug. I would<br>
greatly appreciate any guidance on this issue.<br>
<br>
On Windows when I run Lua test cases from JITed code I am getting<br>
following error:<br>
<br>
Unhandled exception at 0x00007FFCEEEAC500 (ntdll.dll) in lua.exe:<br>
0xC0000028: An invalid or unaligned stack was encountered during an<br>
unwind operation.<br>
<br>
This is happening when the Lua code is attempting to call longjmp().<br>
<br>
The Lua test case that triggers this is a recursive call as shown below.<br>
<br>
function err_on_n (n)<br>
  if n==0 then error(); exit(1);<br>
  else err_on_n (n-1); exit(1);<br>
  end<br>
end<br>
<br>
do<br>
  function dummy (n)<br>
    if n > 0 then<br>
      assert(not pcall(err_on_n, n))<br>
      dummy(n-1)<br>
    end<br>
  end<br>
end<br>
<br>
dummy(10)<br>
<br>
<br>
I have a struct that is created on the stack in the JIT compiler, and<br>
this error is triggered when I add a field to the struct - if I remove<br>
the field the error stops. The struct is not very large in size - it<br>
is only 392 bytes with the new field.<br>
<br>
If I allocate this struct on the heap the error goes away.<br>
<br>
Note that just adding the field triggers the error even if I have no<br>
other code changes.<br>
<br>
The error occurs in Release build but not in Debug build.<br>
I am using Visual C++ 2013 - 64-bit, and LLVM 3.6.0 on Windows.<br>
I see no other unexpected behaviour - all the other tests pass.<br>
<br>
All tests pass on Ubuntu, using LLVM 3.5.1 and gcc 4.8.2.<br>
<br>
Of course I am currently assuming that somewhere my program is<br>
corrupting memory - but as I have no other signs of a memory<br>
corruption - the issue may be something else.<br>
<br>
Any tips on what the problem might be would be gratefully received.<br>
<br>
Thanks and Regards<br>
Dibyendu<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</blockquote></div><br></div>