https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105507
--- Comment #5 from Eric Botcazou <ebotcazou at gcc dot gnu.org> --- > We do have some open bugs re broken exception handling with mingw32, like > https://github.com/msys2/MINGW-packages/issues/9289#issuecomment-945306860 > > Sadly no one stepped up to look into that. Do you think this could be > related? Possible, but the above report clearly points to pitfall #1 with DWARF unwinding: you may *not* have more than a single libgcc in a link. This means that, if you link with a DLL that was linked with the (shared, that's requuired) libgcc, you *cannot* also link with the static libgcc, because this brings 2 libgccs in the link, you *must* link with the shared libgcc. So the rule of thumb is to never use -static-libgcc if you have a GCC-compiled DLL in the link, that's guaranteed to break otherwise.