https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102922
Bug ID: 102922 Summary: [12 Regression] Wrong code at -O3 caused by r12-4625-gfe8475c500939011 Product: gcc Version: 12.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org CC: rguenth at gcc dot gnu.org Target Milestone: --- The following is miscompiled: $ cat driver.cpp long long int var1, var2; void __attribute__((noipa)) test(bool cond, bool cond2, signed char val) { for (unsigned i = 0; i < 1; i++) for (signed j = 0; j < 1; j++) if (cond) { for (int i_44 = 0; i_44 < 100; i_44++) if (cond2) var1 = (bool)val; else var2 = (bool)val; } } int main() { test(true, true, 1); if (var1 != 1) __builtin_abort (); return 0; } $ g++ driver.cpp -O3 && ./a.out Aborted (core dumped)