https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82365
--- Comment #10 from Arnd Bergmann <arnd at linaro dot org> --- I have now observed the problem in another file, this one time that is more commonly used, but not as drastic, as the stack usage is only around 1000 bytes. The original source code is in https://elixir.free-electrons.com/linux/v4.14/source/include/net/ip_vs.h#L1243 This reduces to int a, b, c, d, e; inline char *ip_vs_dbg_addr(char *p1, int *p2) { __builtin_snprintf(&p1[*p2], a, "[%pI6c]", &b); if ((a)) { __builtin_trap(); } return &p1[1]; } void ip_vs_control_add() { do { char f[160]; ip_vs_dbg_addr(f, &e); } while (0); { int g = d; char h[160]; ip_vs_dbg_addr(h, &c); { char i[160]; ip_vs_dbg_addr(i, &g); } { char j[160]; ip_vs_dbg_addr(j, &e); } } char k[160]; ip_vs_dbg_addr(k, &e); } which uses 800 bytes of stack space. Adding an 'asm volatile("");' statement before __builtin_trap() again solves the problem.