Created attachment 49187 [details] Reproducible example The attached program, modeled after `btest.c` in libbacktrace, produces the following output in mingw64 (SEH): 0/0[0] (403180) 0/0[0] (4015da) 0/0[0] (4011a0) 0/0[0] (401510) 0/0[0] (7ffb6e4d7bc0) 0/0[0] (7ffb6e90ce30) The first two numbers are _Unwind_GetIP() and _Unwind_GetIPInfo(). The last number is _Unwind_GetRegionStart(), which appears to be correct. Note how the first address is different from the next three -- this seems to be located in libgcc and should be stripped. Applying https://github.com/gcc-mirror/gcc/pull/48 gives the following: 4015ff/4015ff[0] (4015da) 4013c5/4013c5[0] (4011a0) 40152b/40152b[0] (401510) 7ffb6e4d7bd4/7ffb6e4d7bd4[0] (7ffb6e4d7bc0) 7ffb6e90ce51/7ffb6e90ce51[0] (7ffb6e90ce30) Raw patch attached. Tested on Windows in gcc 8.3.0 in the rtools40 toolchain, a custom msys2 environment: https://cran.r-project.org/bin/windows/Rtools/. The mingw32 (SJLJ) version is not affected.
Created attachment 49188 [details] Proposed patch
$ gcc -v Using built-in specs. COLLECT_GCC=C:\rtools40_\mingw64\bin\gcc.exe COLLECT_LTO_WRAPPER=C:/rtools40_/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/lto-wrapper.exe Target: x86_64-w64-mingw32 Configured with: ../gcc-8.3.0/configure --prefix=/mingw64 --with-local-prefix=/mingw64/local --build=x86_64-w64-mingw32 --host=x86_64-w64-mingw32 --target=x86_64-w64-mingw32 --with-native-system-header-dir=/mingw64/x86_64-w64-mingw32/include --libexecdir=/mingw64/lib --enable-bootstrap --with-arch=x86-64 --with-tune=generic --enable-languages=c,lto,c++,fortran --disable-shared --enable-static --enable-libatomic --enable-threads=posix --enable-graphite --enable-fully-dynamic-string --enable-libstdcxx-filesystem-ts=yes --enable-libstdcxx-time=yes --disable-libstdcxx-pch --disable-libstdcxx-debug --disable-isl-version-check --enable-lto --enable-libgomp --disable-multilib --enable-checking=release --disable-rpath --disable-win32-registry --disable-nls --disable-werror --disable-symvers --with-libiconv --with-system-zlib --with-gmp=/mingw64 --with-mpfr=/mingw64 --with-mpc=/mingw64 --with-isl=/mingw64 --with-pkgversion='Built by Jeroen for the R-project' --with-bugurl=https://github.com/r-windows --with-gnu-as --with-gnu-ld Thread model: posix gcc version 8.3.0 (Built by Jeroen for the R-project)
Patches should be sent to gcc-patches@gcc.gnu.org
Done.
Solved by https://gcc.gnu.org/pipermail/gcc-patches/2020-September/553418.html.
Should be fixed on trunk now.