http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51907
Bug #: 51907 Summary: SIGSEGV in _Unwind_GetIP Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: pl...@agmk.net Target: x86_64-w64-mingw32 hi, the following code compiled for x86_64-w64-mingw32 crashes inside libgcc: #include <cstdio> #include <unwind.h> namespace backtracexx { _Unwind_Reason_Code helper( struct _Unwind_Context* ctx, void* ) { std::printf( "helper( ctx = %p ) => ", (void*)ctx ); _Unwind_Ptr ip = _Unwind_GetIP( ctx ); std::printf( "ip = %p\n", (void*)ip ); return _URC_NO_REASON; } void scan() { _Unwind_Backtrace( reinterpret_cast< _Unwind_Trace_Fn >( helper ), 0 ); } } int main() { backtracexx::scan(); } d:\test>d:\mingw64\bin\x86_64-w64-mingw32-g++ example.cpp -g2 -o example.exe d:\test>d:\mingw64\bin\x86_64-w64-mingw32-g++ -v Using built-in specs. COLLECT_GCC=d:\mingw64\bin\x86_64-w64-mingw32-g++ COLLECT_LTO_WRAPPER=d:/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/4.7.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../../../build/gcc/src/configure --target=x86_64-w64-mingw32 --prefix=/c/bb/vista64-mingw32/mingw-x86-x86_64/bu ild/build/root --with-sysroot=/c/bb/vista64-mingw32/mingw-x86-x86_64/build/build/root --enable-languages=all,obj-c++ --enable-fu lly-dynamic-string --disable-multilib Thread model: win32 gcc version 4.7.0 20111220 (experimental) (GCC) (gdb) r Starting program: d:\test/example.exe [New Thread 2448.0xaa8] helper( ctx = 000000000022FDD0 ) => Program received signal SIGSEGV, Segmentation fault. 0x000000006cecea63 in _Unwind_GetIP (context=0x22fdd0) at ../../../../../build/gcc/src/libgcc/unwind-sjlj.c:214 214 ../../../../../build/gcc/src/libgcc/unwind-sjlj.c: No such file or directory. in ../../../../../build/gcc/src/libgcc/unwind-sjlj.c (gdb) bt #0 0x000000006cecea63 in _Unwind_GetIP (context=0x22fdd0) at ../../../../../build/gcc/src/libgcc/unwind-sjlj.c:214 #1 0x0000000000401529 in backtracexx::helper (ctx=0x22fdd0) at example.cpp:9 #2 0x000000006cecee55 in _Unwind_Backtrace (trace=0x401500 <backtracexx::helper(_Unwind_Context*, void*)>, trace_argument=0x0) at ../../../../../build/gcc/src/libgcc/unwind.inc:295 #3 0x0000000000401564 in backtracexx::scan () at example.cpp:15 #4 0x000000000040157d in main () at example.cpp:21