Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 159274

Summary: Optimizing produces incorrect code in some for loops
Product: [Fedora] Fedora Reporter: Kasper Dupont <bugzilla>
Component: gccAssignee: Jakub Jelinek <jakub>
Severity: medium Docs Contact:
Priority: medium    
Version: 3   
Target Milestone: ---   
Target Release: ---   
Hardware: i586   
OS: Linux   
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-06-01 13:13:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Description Flags
Source that demonstrates the bug none

Description Kasper Dupont 2005-06-01 10:34:07 UTC
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 10:36:59 UTC
Created attachment 115020 [details]
Source that demonstrates the bug

Comment 2 Jakub Jelinek 2005-06-01 13:13:48 UTC
Tracking upstream.  gcc 3.2.3 fails the same way, gcc 4.0.0 is ok.