https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91207
Bug ID: 91207 Summary: Wrong code with -O3 Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: vsevolod.livinskij at frtk dot ru Target Milestone: --- GCC produces wrong code with -O3. Reproducer: #include <stdio.h> long long a; int b[92][32]; unsigned int c, d; void e(long long *f, int p2) { *f = p2; } int main() { for (int i = 6; i <= 20; d = i++) for (int j = 6; j <= 91; j++) { for (int k = 16; k <= 31;k++) b[j][k] ^= 7; c *= d; } for (int i = 0; i < 21; ++i) for (int j = 0; j < 32; ++j) e(&a, b[i][j]); printf("%llu\n", a); } Error: >$ gcc -O0 repr.c ; ./a.out 7 >$ gcc -O3 repr.c ; ./a.out 0 GCC version is 10.0.0 (Revision: 273580)