Closed 614eaf53-7ecd-4c4f-a941-40bf78db1486 closed 5 years ago
This should be fixed in SVN r348836.
The backtrace looks like this for me:
Thread 1 received signal SIGSEGV, Segmentation fault. 0x00007ffd6763820c in ntdll!RtlLookupFunctionEntry () from C:\WINDOWS\SYSTEM32\ntdll.dll (gdb) bt bt
at /home/martin/clang-nightly/x86_64-w64-mingw32/include/c++/v1/iosfwd:117
at /home/martin/code/repro-except/parser/sourcereader.cpp:84
dsp_content=<optimized out>, error_msg=..., generate=<optimized out>)
at /home/martin/code/repro-except/main.cpp:21
To add more context to the bug; this happens when unwinding x86_64 SEH with libunwind - if the unwinder is replaced with libgcc, unwinding works fine.
CC:ing Charles who wrote the SEH unwinder for libunwind.
Also, there's a compiled version of the repro at https://martin.st/temp/repro-except-binaries.zip. If you run "faust.exe foo.dsp", you'll get the crash. If you replace libunwind.dll with libgcc_s_seh-1.dll and retry, the crash goes away.
Extended Description
Hello, I originally posted this issue here : https://github.com/mstorsjo/llvm-mingw/issues/25
The attached repro gives an example which causes a segfault (with the llvm-mingw toolchain) The build.sh script will build a code and launch the program in the case which causes the problem (segfault while unwinding). There are a bunch of files but the actual stack trace is very short and only spans two files (main.cpp and parser/sourcereader.cpp):
Thread 1 hit Catchpoint 1 (exception thrown), 0x0000000140010a90 in __cxa_throw () (gdb) bt
0 0x0000000140010a90 in __cxa_throw ()
1 0x000000014000657d in SourceReader::parseLocal (this=,
2 0x0000000140006235 in SourceReader::parseFile (this=,
3 0x000000014000c4fa in compileFaustFactory (argc=,
4 0x000000014000c668 in main (argc=,
The smallest change to the code path, for instance changing parseLocal from :
Tree SourceReader::parseLocal(const char* fname) { stringstream error;
}
to
Tree SourceReader::parseLocal(const char* fname) { throw faustexception("blah"); return gGlobal->gResult; }
or removing the untaken if branch in sourcereader.cpp:79, makes the problem go away.
Also, it works at -O1, it's only starting from -O2 that it fails.
The same code works fine with clang on both linux and macos.