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 - Optimizing produces incorrect code in some for loops
Summary: Optimizing produces incorrect code in some for loops
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 3
Hardware: i586
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2005-06-01 10:34 UTC by Kasper Dupont
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-06-01 13:13:48 UTC

Attachments (Terms of Use)
Source that demonstrates the bug (deleted)
2005-06-01 10:36 UTC, Kasper Dupont
no flags Details

System ID Priority Status Summary Last Updated
GNU Compiler Collection 21862 None None None Never

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.

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