Bug 28385 - g++ -O hangs while compiling file
Summary: g++ -O hangs while compiling file
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.0
Hardware: i386 Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
: 31937 (view as bug list)
Depends On:
TreeView+ depends on / blocked
Reported: 2001-02-20 04:56 UTC by David Baron
Modified: 2005-10-31 22:00 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2001-02-21 21:23:47 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
nsStyleContext.ii - preprocessed source (428.62 KB, text/plain)
2001-02-20 04:57 UTC, David Baron
no flags Details

Description David Baron 2001-02-20 04:56:41 UTC
As of this afternoon, g++ hangs while compiling nsStyleContext.cpp in the
Mozilla tree with -O2.  I'll attach the preprocessed output to make for
easy testing.  Given nsStyleContext.ii that I will attach, the command

c++ -c -o nsStyleContext.o -O2 nsStyleContext.ii

hangs, while the command

c++ -c -o nsStyleContext.o nsStyleContext.ii

works correctly.

I'm seeing this with gcc-2.96-70 and -O2.  tor reports the same problem
with gcc-2.96-74 and -O (rather than -O2).  mao reports it with

Comment 1 David Baron 2001-02-20 04:57:44 UTC
Created attachment 10440 [details]
nsStyleContext.ii - preprocessed source

Comment 2 Jakub Jelinek 2001-02-20 11:36:31 UTC
Thanks. Actually, CVS head hangs on this as well.
The culprit is:
inline void CalcSidesFor(const nsIFrame* aFrame, const nsStyleSides& aSides,
                         PRUint8 aSpacing,
                         const nscoord* aEnumTable, PRInt32 aNumEnums,
                         nsMargin& aResult)
  nsStyleCoord coord;

  aResult.left = CalcSideFor(aFrame, aSides.GetLeft(coord), aSpacing, 3,
                             aEnumTable, aNumEnums);
  aResult.top = CalcSideFor(aFrame, aSides.GetTop(coord), aSpacing, 0,
                            aEnumTable, aNumEnums);
  aResult.right = CalcSideFor(aFrame, aSides.GetRight(coord), aSpacing, 1,
                              aEnumTable, aNumEnums);
  aResult.bottom = CalcSideFor(aFrame, aSides.GetBottom(coord), aSpacing, 2,
                               aEnumTable, aNumEnums);
and the tree based inlining for some reason does not limit itself in doing
further and further inlines of itself in this case (because CalcSideFor indirectly
calls CalcSidesFor). I'll try to simplify it first.

Comment 3 Akkana 2001-02-20 20:18:36 UTC
With -O (not O3) and with gcc-2.96-54, it takes a long time, and finally gives
up with:
Cannot allocate 892625676 bytes after allocating 16260924 bytes

Comment 4 Jakub Jelinek 2001-02-20 20:22:17 UTC
I've narrowed it down to a 3K testcase and it really does not hang, it just
does a lot of inlining and eats gobs of memory (if I remove one of the 4
routines for inlining, it actually succeeds on my 256MB box, otherwise I never
had the patience to let it finish). I hope I'll know more tomorrow.

Comment 5 Christopher Blizzard 2001-02-21 20:16:59 UTC
Any movement on this?  It's a real killer.

Comment 6 Jakub Jelinek 2001-02-21 21:23:43 UTC
Yes, I think I've fixed this by:
Mark Mitchell approved it, if Jason Merrill does not have anything
against it until tomorrow, I'll commit it and will include it into

Comment 7 David Baron 2001-02-23 19:25:32 UTC
Are you committing the patch to both the gcc trunk and the gcc 3.0 branch?  I
sure hope this is fixed in gcc 3.0 also.

Comment 8 Jakub Jelinek 2001-02-23 20:42:54 UTC
Sure, I've commited it to both branch and head.

Comment 9 Jakub Jelinek 2001-03-16 10:36:24 UTC
*** Bug 31937 has been marked as a duplicate of this bug. ***

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