Bug 159274 - Optimizing produces incorrect code in some for loops
Optimizing produces incorrect code in some for loops
Product: Fedora
Classification: Fedora
Component: gcc (Show other bugs)
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Depends On:
  Show dependency treegraph
Reported: 2005-06-01 06:34 EDT by Kasper Dupont
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-06-01 09:13:48 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Source that demonstrates the bug (1.25 KB, text/x-csrc)
2005-06-01 06:36 EDT, Kasper Dupont
no flags Details

External Trackers
Tracker ID Priority Status Summary Last Updated
GNU Compiler Collection 21862 None None None Never

  None (edit)
Description Kasper Dupont 2005-06-01 06:34:07 EDT
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):

How reproducible:

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

Additional info:

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.
Comment 1 Kasper Dupont 2005-06-01 06:36:59 EDT
Created attachment 115020 [details]
Source that demonstrates the bug
Comment 2 Jakub Jelinek 2005-06-01 09:13:48 EDT
Tracking upstream.  gcc 3.2.3 fails the same way, gcc 4.0.0 is ok.

Note You need to log in before you can comment on or make changes to this bug.