https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38534
--- Comment #9 from Lukas Grätz <lukas.gra...@tu-darmstadt.de> --- (In reply to H.J. Lu from comment #8) > (In reply to Lukas Grätz from comment #7) > > (In reply to H.J. Lu from comment #4) > > > When I compiled __cxxabiv1::__cxa_throw, which is a noreturn function in > > > libstdc++-v3/libsupc++/eh_throw.cc not to save callee-saved registers, > > > most of C++ exception tests crashed. > > > > Can you tell how you compiled it? Thanks in advance! > > I have a patch to fix it. Please try users/hjl/pr113312/gcc-13 branch: > > > For your testcase, I got Well it is not my testcase. But I added backtracing and observed that the printed backtrace is unchanged with your patch. The new no_return_to_caller(): void __attribute__((noreturn)) no_return_to_caller(int a, int b, int c, int d) { LOOP_BODY; #define BT_BUF_SIZE 100 void *buffer[BT_BUF_SIZE]; backtrace_symbols_fd(buffer, backtrace(buffer, BT_BUF_SIZE), STDOUT_FILENO); while (1); } What I observed from the assembly is that %rbp is not saved, whereas %rip and %rsp are still implicitly saved by the call instruction. But since glibc's backtrace implementation does not use %rbp, this is fine. Some amateur speculation, just ignore it: I don't know whether %rbp is the source of the failed C++ test cases, which also do some stack unwinding. After looking in the System V Abi specification I am still unsure whether stack unwinding relies on %rbp or not. Perhaps there is an unnecessary dependency on %rbp or a missing "-fno-omit-frame-pointer" somewhere in the gcc internals that causes the problem.