[LLVMdev] Invalid or unaligned stack exception on Windows
Dibyendu Majumdar
mobile at majumdar.org.uk
Sat Apr 25 13:19:36 PDT 2015
Hi,
I wrote sometime ago about this issue (see links below).
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-March/084089.html
http://lists.cs.uiuc.edu/pipermail/llvmdev/2015-April/084193.html
At the time I thought the problem was due to a bug in my code, and
that I had fixed it. But sadly it seems that the issue is still
present - it just got hidden by whatever change I made.
The error only occurs when a longjmp() call is invoked - but not at
every longjmp() call - many longjmp() calls appear to be fine while
one of them fails. Depending on compilation option (/O1 or /O2) the
failure occurs at different places so I cannot spot an obvious
pattern.
The scenario is:
C code calls setjmp() and eventually calls JITed code.
JITed code calls a C function
C function calls other C functions eventually leading to longjmp() call.
Note that the longjmp call is not directly from JITed code.
The error only occurs on Windows. I am using Visual Studio 2013
64-bit. However, it does not occur in a debug build (MSVC optimization
mode /Od) - but occurs when I use /O1 or /O2.
I do not get this error on MAC OSX Yosemite (using clang) or on Ubuntu
(using gcc).
On Ubuntu I am running gcc with -fsanitize=address to detect any memory issues.
LLVM JIT optimization does not make a difference - i.e. the error
occurs regardless of LLVM optimization settings.
I am really at a loss as to how to find the root cause.
How can I check whether there are stack alignment issues in JITed code?
Can I enable address sanitizer in MCJIT so that any memory errors can
be trapped?
Should I build LLVM and my project using mingw-64 to see if same error
occurs - is this supported on Windows?
I would really appreciate any input on this issue.
Thanks and Regards
Dibyendu
More information about the llvm-dev
mailing list