https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100566
--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Though, on more reduced testcase from that it started already in r9-2635-g78ea9abc2018243af7f7ada6135144ac90c6ad27 (likewise at -O2): volatile int s, c; __attribute__((noipa)) void foo (void) { if (c++ > 1) __builtin_abort (); } __attribute__((noipa)) int bar (void) { int i = 0, j = s; if (j == 0) goto lab; for (i = 0; i < j; i++) { lab: foo (); if (!j) goto lab; } return 0; } int main () { s = 1; bar (); if (c != 1) __builtin_abort (); return 0; }