Bug 57574 - gcc 3.1-0.10 bad code for switch statement with -O
Summary: gcc 3.1-0.10 bad code for switch statement with -O
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Raw Hide
Classification: Retired
Component: gcc
Version: 1.0
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2001-12-16 09:34 UTC by Valdis Kletnieks
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2001-12-19 17:35:48 UTC
Embargoed:


Attachments (Terms of Use)
z9.i.gz file - test case. gunzip, then 'gcc -O -c z9.i' (38.87 KB, application/octet-stream)
2001-12-16 09:35 UTC, Valdis Kletnieks
no flags Details

Description Valdis Kletnieks 2001-12-16 09:34:05 UTC
Description of Problem: gcc -O generates bad code for switch statement


Version-Release number of selected component (if applicable):
gcc-3.1-0.10

How Reproducible: 'gcc -O -c z9.i' with attached z9.i - the switch
statement in pdump_get_indirect_count is miscompiled with -O, generating an
undefined reference to a label in a branch table.


Steps to Reproduce:
1. unzip z9.i.gz
2. gcc -v -c z9.i  and then 'nm z9.o | grep L'  - none found.
3. gcc -V -O3 -c z9.i  and 'mn z9.o | grep L'

Actual Results: -O, -O1, -O2, and -O3 all miscompile the switch statement,
leaving a dangling '.long .L<n>' for varying values of <N> depending on the
-O level.  This results in an undefined symbol when you try to link the
program.


Expected Results: Correct code generated.


Additional Information:
I have attached a 'z9.i.gz' file - unzip and compile as above.

Comment 1 Valdis Kletnieks 2001-12-16 09:36:00 UTC
Created attachment 40767 [details]
z9.i.gz file - test case. gunzip, then 'gcc -O -c z9.i'

Comment 2 Jakub Jelinek 2001-12-19 17:35:43 UTC
See http://gcc.gnu.org/ml/gcc-patches/2001-12/msg02108.html

Comment 3 Jakub Jelinek 2001-12-31 10:24:00 UTC
Should be fixed in gcc-3.1-0.11.


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