https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83277
Bug ID: 83277 Summary: [8 Regression] [graphite] Wrong code w/ -O2 -floop-nest-optimize Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: wrong-code Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- gcc-8.0.0-alpha20171126 snapshot (r255155), as well as gcc-8.0.0-alpha20171203 snapshot (r255368) w/ r255382 applied on top of it, produce wrong code w/ -O2 -floop-nest-optimize for the following snippet: int rk, si = 0; int jr[2]; int wv (signed char n8) { const int tw = 8; int xq[tw]; int bj, pu = 0; for (bj = 0; bj < tw; ++bj) xq[bj] = 0; bj = 0; while (bj < 1) { int gs = n8 ^ 128; if (gs != 0) { int u7[3]; while (bj < 2) { u7[bj] = 0; ++bj; } jr[0] = u7[0]; rk = xq[0]; pu = n8; if (si != 0) return si; } } return pu; } int main (void) { signed char ax = 1; return wv (ax) != ax; } % gcc-8.0.0-alpha20171203 -O2 -o good lu41pybr.c && ./good % echo $? 0 % gcc-8.0.0-alpha20171203 -O2 -floop-nest-optimize -o bad lu41pybr.c && ./bad zsh: exit 1 ./bad % echo $? 1