From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4.1) Gecko/20031114
Description of problem:
The attached program is supposed to execute a for loop 262144 times, but when compiled with -O2, -O3, or -Os, the loop is executed only once.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Download the attached file for-loop-optimizing-bug.c
2. gcc -Wall -W -O2 -s for-loop-optimizing-bug.c -o for-loop-optimizing-bug
3. ./for-loop-optimizing-bug | wc -c
Actual Results: 4096
Expected Results: 1073741824
This FC3 system is using kernel version 2.6.11-1.27_FC3. Notice that this bug is not limited to i586, I have reproduced it on an i686 systems running FC2 and an athlon system running FC1.
Created attachment 115020 [details]
Source that demonstrates the bug
Tracking upstream. gcc 3.2.3 fails the same way, gcc 4.0.0 is ok.