In __cxa_get_globals, the code does: if ((g = (__cxa_eh_globals *) std::malloc (sizeof (__cxa_eh_globals))) == 0 || __gthread_setspecific (globals_key, (void *) g) != 0) std::terminate ();
but since __cxa_get_globals is called in __cxa_allocate_exception, the effect of this is that if the first exception thrown in a program is an out-of-memory exception, the program will instead call std::terminate, because it won't be able to allocate a new __cxa_eh_globals. std::terminate itself expects __cxa_get_globals to work, so it'll call itself recursively, leading to an abort() in __verbose_terminate_handler. -- Summary: libstdc++ crashes when out of memory exception thrown Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P2 Component: libstdc++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: geoffk at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24025