https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106409
--- Comment #8 from Thiago Macieira <thiago at kde dot org> --- (In reply to Andrew Pinski from comment #7) > See PR 58525 also which added that code path. That explains why it won't call __cxa_throw_bad_array_new_length, but not why it will call operator new[](-1). My suggestion is to keep __cxa_throw_bad_array_new_length for the exceptions case and add a new function for the non-exceptional case. This function could: * call operator new[], which would probably cause the stack unwinder to terminate the application * call std::terminate() directly, possibly after printing something to stderr * return null pointer * something else (generate debug break, raise(SIGKILL), etc.)