[LLVMdev] Invalid or unaligned stack exception on Windows

Dibyendu Majumdar mobile at majumdar.org.uk
Mon Apr 27 16:23:53 PDT 2015


On 27 April 2015 at 19:04, Reid Kleckner <rnk at google.com> wrote:
> 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.

Hi,
Lua uses its own stack (which is just an array of value objects), and
Lua functions basically manipulate this data structure.

>
> What triple are you using with LLVM to generate code?

x86_64-pc-windows-msvc-elf

>
> 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.
>

Thank you - I will try this, although Pawel's reply on this issue
seems like a plausible explanation.
I am trying to figure out how to dump the disassembly from the
compiled code - it seems not so easy as dumping IR.
I will also try compiling the using clang or gcc to see if that makes
the problem go away.

Thanks and Regards
Dibyendu



More information about the llvm-dev mailing list