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 77532 - gcc hang on compilation with -O2 but fine with just -g
Summary: gcc hang on compilation with -O2 but fine with just -g
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc
Version: 8.0
Hardware: athlon
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Brian Brock
Depends On:
TreeView+ depends on / blocked
Reported: 2002-11-08 17:28 UTC by matt bettencourt
Modified: 2007-04-18 16:48 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2004-10-03 10:24:20 UTC

Attachments (Terms of Use)
strace output of hang... (deleted)
2002-11-13 17:33 UTC, Michael Lee Yohe
no flags Details

Description matt bettencourt 2002-11-08 17:28:01 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2b) Gecko/20021017

Description of problem:
gcc on a RH8.0 system (fully patched) hangs on compilation of a 126 line file
(5K fully preprocessed) when you compile with -g -O2 but is fine with -g only. 
The preprocessed file hangs on a RH7.3 system with both gcc3 and gcc 
8.0 system
rpm -q gcc

7.3 system
{attica} 155 % rpm -q gcc3
{attica} 156 % rpm -q gcc

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

How reproducible:

Steps to Reproduce:
1.get file at
2.gcc -O2 -g gccbug.c
3. wait . . . . . .

Actual Results:  Hangs on step 2

Expected Results:  get a .o file or error

Additional info:

Comment 1 Michael Lee Yohe 2002-11-13 17:32:47 UTC
There a missing header files to be able to compile this source from start to
finish.  But your sole source file does indeed hang on -O2, but not -O1 or -g. 
I'll add an strace output attachment.

Comment 2 Michael Lee Yohe 2002-11-13 17:33:27 UTC
Created attachment 84844 [details]
strace output of hang...

Comment 3 Michael Lee Yohe 2002-11-13 17:34:48 UTC
Infinite loop, perhaps?  Strange that there is nothing being flooded to strace.
 7908 myohe     25   0 10684  10M  2184 R    92.2  1.3   0:30 cc1

Comment 4 Jakub Jelinek 2002-11-14 10:13:34 UTC
Doesn't look like 5K preprocessed, more like 88K one function which causes
problems, with > 1000 if statements.
It seems like a bug in strength reduction (happens in gcc 3.3 20021113 too),
so for now you could get around this with -fno-strength-reduce.
Will try to simplify this testcase before debugging.

Comment 5 Richard Henderson 2004-10-03 10:24:20 UTC
404: File not found.
Attach files rather than pointing to ephemeral external urls.

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