https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91293
Bug ID: 91293 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 option. Reproducer: #include <stdio.h> long long a; unsigned b, c; int d = 62; void e(long long *f, int p2) { *f = p2; } int main() { for (int g = 2; g <= d; g++) { c += 5 - g; b += g + 4; } e(&a, b); printf("%llu\n", a); } Error: >$ gcc -march=skylake-avx512 -O3 small.c ; ./a.out 18446744073709550508 >$ gcc -march=skylake-avx512 -O0 small.c ; ./a.out 2196 GCC version: 10.0.0 (rev. 273839)