https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66131
Bug ID: 66131 Summary: [6 Regression] Wrong code w/ -O2 -ftree-loop-linear Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- gcc produces wrong code w/ -ftree-loop-linear -O2 (and above) for the following reduced case: int fk = 0; int vm, ft; static int qr(void) { int *op[33] = { &fk }; int **ts[1] = { &op[0] }; for (fk = 0; fk < 2; ++fk) for (ft = 0; ft < 1; ++ft) vm = fk; return 0; } static int ay(void) { int yc; for (ft = 0; ft < 1; ++ft) for (vm = 0; vm < 1; ++vm) { fk |= 1; return qr(); } for (fk = 0; fk < 1; ++fk) for (yc = 0; yc < 2; ++yc) for (vm = 0; vm < 1; ++vm) for (ft = 0; ft < 1; ++ft) { } return 0; } int main(void) { ay(); return vm != 1; } Expected results: % gcc-6.0.0-alpha20150503 -ftree-loop-linear -O2 -Wall -Wextra -Wpedantic dfc7c304.c % ./a.out % echo $? 0 Actual results: % gcc-6.0.0-alpha20150503 -ftree-loop-linear -O2 -Wall -Wextra -Wpedantic dfc7c304.c % ./a.out % echo $? 1 This issue may be somewhat similar to PR63602.