https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38534
--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Lukas Grätz from comment #9) > 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. The C++ test issue is caused by missing callee-saved registers for exception supports in noreturn functions in libstdc++. I fixed it by keeping callee-saved registers when exception is enabled. Backtrace with %rbp is unrelated to this. Gcc will skip %rpb without -fno-omit-frame-pointer.