https://gcc.gnu.org/bugzilla/show_bug.cgi?id=38534
--- Comment #28 from Jakub Jelinek <jakub at gcc dot gnu.org> --- (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(): You haven't tried hard enough. Consider the testcase I've posted to the mailing list, built with -Og -g. It is artificial in that register pressure is increased artificially rather than coming from meaningful code, noipa attribute is used heavily instead of functions being too large or in different TUs, and optimize attribute used instead of the noreturn function sitting in a different library, built there with -O2, while user program say with -Og. extern void abort (void); volatile unsigned v = 0xdeadbeefU; int w; __attribute__((noipa)) void corge (char *p) { (void) p; } __attribute__((noipa)) int foo (int x) { return x; } __attribute__((noipa, noreturn, optimize (2))) void bar (void) { unsigned a = v; unsigned b = v; unsigned c = v; unsigned d = v; unsigned e = v; unsigned f = v; unsigned g = v; unsigned h = v; int i = foo (50); v = a + b + c + d + e + f + g + h; abort (); } __attribute__((noipa)) void baz (int a, int b, int c, int d, int e, int f, int g, int h) { int i = foo (51); if (w) bar (); } __attribute__((noipa)) void qux (void) { int a = foo (42); int b = foo (43); int c = foo (44); int d = foo (45); int e = foo (46); int f = foo (47); int g = foo (48); int h = foo (49); corge (__builtin_alloca (foo (52))); baz (a, b, c, d, e, f, g, h); w++; baz (a, b, c, d, e, f, g, h); baz (a, b, c, d, e, f, g, h); } int main () { qux (); } Before the r14-8470 changes the backtrace on abort was #0 0x00007ffff7dbd765 in abort () from /lib64/libc.so.6 #1 0x00000000004011ca in bar () at /tmp/1.c:30 #2 0x00000000004011f1 in baz (a=a@entry=42, b=b@entry=43, c=c@entry=44, d=d@entry=45, e=e@entry=46, f=f@entry=47, g=48, h=49) at /tmp/1.c:38 #3 0x00000000004012d8 in qux () at /tmp/1.c:55 #4 0x0000000000401319 in main () at /tmp/1.c:62 The gcc trunk hits the backtrace not possible problem because rbp is clobbered and needed in upper frame CFA computation: #0 0x00007ffff7dbd765 in abort () from /lib64/libc.so.6 #1 0x00000000004011b0 in bar () at /tmp/1.c:30 #2 0x00000000004011d1 in baz (a=<error reading variable: Cannot access memory at address 0xdeadbebb>, b=<error reading variable: Cannot access memory at address 0xdeadbeb7>, c=<error reading variable: Cannot access memory at address 0xdeadbeb3>, d=d@entry=-559038737, e=e@entry=-559038737, f=f@entry=-559038737, g=48, h=49) at /tmp/1.c:38 #3 0x00000000004012a9 in qux () at /tmp/1.c:55 Backtrace stopped: previous frame inner to this frame (corrupt stack?) And in the patched gcc (with PR114116 patch to save bp register) backtrace works but several of the values are bogus: #0 0x00007ffff7dbd765 in abort () from /lib64/libc.so.6 #1 0x00000000004011b1 in bar () at /tmp/1.c:30 #2 0x00000000004011d2 in baz (a=a@entry=42, b=b@entry=43, c=c@entry=44, d=d@entry=-559038737, e=e@entry=-559038737, f=f@entry=-559038737, g=48, h=49) at /tmp/1.c:38 #3 0x00000000004012aa in qux () at /tmp/1.c:55 #4 0x00000000004012e4 in main () at /tmp/1.c:62 So, I think we should limit this to -fno-unwind-tables or maybe -mcmodel=kernel.