https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108657
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Status|UNCONFIRMED |NEW Last reconfirmed| |2023-02-15 --- Comment #17 from Jakub Jelinek <jakub at gcc dot gnu.org> --- In the assembly, the important difference is that with just -O3 c is assigned 1 before calling the first bar, while -O3 -ftrivial-auto-var-init=zero it is assigned 0. This is visible already in optimized dump, which for the latter stores first c = 1; and then twice c = 0; among the various DEFERRED_INITs. Even further reduced: int c, e, f; static int *d = &c; __attribute__((noipa)) void foo (void) { if (c != 1) __builtin_abort (); } int main () { for (c = 1; c >= 0; c--) { e = 0; for (int j = 0; j <= 2; j++) { short k[1]; if (e) break; e ^= f; } } *d = 1; foo (); }