-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash with rethrow_exception
and EXCEPTION_STACK_TRACES
if first exception base class contains virtual methods
#23733
Comments
Just to confirm, this only happens with |
@sbc100 I couldn't get it to compile with I thought Clang crash
Idk, maybe that option does something unrelated? |
Regarding the missing |
@sbc100 No, apparently this issue does not occur with |
A program crashes when using
std::rethrow_exception(std::current_exception())
with EmscriptenEXCEPTION_STACK_TRACES
enabled if the exception has multiple base classes, one of which inherits fromstd::exception
, if said base class is not the first one, and the actual first base class has virtual methods.This only happens with
-fwasm-exceptions
, not with Emscripten-fexceptions
.This seems vaguely related to #6449, but it is closed. This issue only happens with
std::rethrow_exception
, not withthrow;
.Steps to reproduce
main.cpp
with the following contents:-o hello.html
and open with a browser), and observe output:-DTWO_VIRTUAL
for extra weird effects:Note that it says
rethrow_exception typeid: St13runtime_error
, which makes no sense.-fsanitize=address
:Output
I discovered this when a Boost exception triggered this bug via
boost::throw_exception
, which throwsboost::wrapexcept
(possibly adding line info), which first inherits from some Boost class with virtual methods and then from the exception class you put into it. Example:BOOST_THROW_EXCEPTION(std::logic_error("Some logic error"));
.(This also happens with
-sMEMORY64
, btw.)Expected behavior
(Same with
em++ -g main.cpp -fwasm-exceptions -o hello.js -sNO_ASSERTIONS
, disablingEXCEPTION_STACK_TRACES
.)Version of emscripten/emsdk
The text was updated successfully, but these errors were encountered: