[LLVMdev] Invalid or unaligned stack exception on Windows

Reid Kleckner rnk at google.com
Mon Apr 27 11:04:04 PDT 2015


Are you using split stacks of some kind? Are you sure these actually work
as intended on Win64? Based on the source code, it looks like you are
allocating stack manually, but I could be wrong.

What triple are you using with LLVM to generate code?

There isn't much else information here, but you can try to zero in on the
problem by checking the stack alignment manually with a helper like:
void CheckAlignment() {
  assert((((uintptr_t)_AddressOfReturnAddress() + 8) & 15) == 0);
}

Run this near where LLVM calls back into C code. If it fails, disassemble
the calling LLVM function and look at that to see if there's something
wrong with the prologue. Sending that along with any followups would be
helpful.

On Sat, Apr 25, 2015 at 3:07 PM, Dibyendu Majumdar <mobile at majumdar.org.uk>
wrote:

> I have an example test program (smallest I could construct) that
> triggers the problem. The relevant line is commented in the code.
>
>
> https://github.com/dibyendumajumdar/ravi/tree/master/ravi-tests/longjmp_issue
>
> I have also dumped the IR for the three functions that are compiled.
>
> The C code that does the longjmp and setjmp is at:
>
> https://github.com/dibyendumajumdar/ravi/blob/master/src/ldo.c
>
> See functions luaD_throw() and luaD_rawrunprotected()
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150427/5da99b49/attachment.html>


More information about the llvm-dev mailing list