gcc --version gcc (SUSE Linux) 4.3.2 [gcc-4_3-branch revision 141291] code a.c: #include <stdio.h> main() { int i; for (i = 1; i > 0; i *= 2) printf("%d\n",i); }
1. build: gcc -O a.c -o a Run: ./a 1 2 4 ... 4536870912 1073741824 2. build: gcc -O2 a.c -o a Run: ./a 1 2 4 ... 4536870912 1073741824 0 0 0 0 ... -- Summary: bug in optimalization O2 Product: gcc Version: 4.3.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: vcelakv at seznam dot cz http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39759