https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61664
Alp Sayin <alpsayin at alpsayin dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |alpsayin at alpsayin dot com --- Comment #2 from Alp Sayin <alpsayin at alpsayin dot com> --- This issue still persists. I've hit the exact same problem with gcc-12.1.0 built from zephyrproject-rtos/gcc fork. But more interestingly, I noticed that following code example is able to catch the exception. Whereas any alteration either causes std:terminator to kick in or it causes the unwinder to hang. int main() { try { throw 42; } // doesnt have to be char type can be any type, but remove this catch and it exits (std::terminator goes to _exit()) catch (char c){} catch (int i) { printf("int catcher\n"); std::exception_ptr p = std::current_exception(); printf("Exception Value: 0x%08x/%dd\n", (int)&p, **(int**)&p); printf("Exception Type: %s\n", p ? p.__cxa_exception_type()->name() : "null"); return; } catch (...) { printf("all catcher\n"); std::exception_ptr p = std::current_exception(); printf("Exception Value: 0x%08x/%dd\n", (int)&p, **(int**)&p); printf("Exception Type: %s\n", p ? p.__cxa_exception_type()->name() : "null"); return; } printf("missed all catch"); }