LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12550 - Windows 64 bits (Visual Studio): "foreign" C++ exceptions unwinding through LLVM cause a crash
Summary: Windows 64 bits (Visual Studio): "foreign" C++ exceptions unwinding through L...
Status: RESOLVED DUPLICATE of bug 24233
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC Windows NT
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-04-13 10:54 PDT by Jerome Couture-Gagnon
Modified: 2015-10-21 15:28 PDT (History)
5 users (show)

See Also:
Fixed By Commit(s):


Attachments
Repro program (3.27 KB, text/plain)
2012-04-13 10:54 PDT, Jerome Couture-Gagnon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Couture-Gagnon 2012-04-13 10:54:36 PDT
Created attachment 8385 [details]
Repro program

We are currently porting our application to Windows 64 bits (amd64), and we are getting regressions from 32 bits relatively to LLVM 3.0's ability to get traversed by "foreign" Visual Studio C++ exceptions. That is, there is a crash when C++ exceptions which are thrown from Visual Studio code, are unwinding through LLVM code before being eventually catch by other Visual Studio code.

Note: I am not sure if this is specific to Visual Studio.

I was able to repro the issue simply by modifying the Fibonacci example to call an external C++ function which throws an exception, much like in ExceptionsDemo.cpp: works on 32 bits but not on 64 bits Visual Studio. The crash happens within Windows' _cxxThrowException routine.

Attached is the file containing the "repro" executable (to be compiled with the same settings as the Fibonacci example). The program does a recursive call of depth "N", with "N" being passed as an arg (like in the Fibonacci example). Here it crashes even with N=0, on 64 bits.
Comment 1 NAKAMURA Takumi 2012-04-15 06:40:29 PDT
Clang has not supported Win64 EH yet.
LLVM might support it, but it is not activated IIRC.


(In reply to comment #0)
> We are currently porting our application to Windows 64 bits (amd64), and we are
> getting regressions from 32 bits relatively to LLVM 3.0's ability to get
> traversed by "foreign" Visual Studio C++ exceptions. That is, there is a crash
> when C++ exceptions which are thrown from Visual Studio code, are unwinding
> through LLVM code before being eventually catch by other Visual Studio code.

I don't imagine i686-msvc-llvm could handle MS EH.
Comment 2 Reid Kleckner 2015-10-21 15:28:09 PDT
The issue is that JITs need to register xdata with the OS on win64. LLVM's JIT has never had this ability. PR24233 has a better description of the work that needs to be done, so I'm duping against it.

We already know what xdata to generate because we can compile normal C++ code ahead of time and MSVC exceptions can unwind through our code just fine.

*** This bug has been marked as a duplicate of bug 24233 ***