Bug 31937 - c++ hangs (and finally crashes) compiling Mozilla with optimization
Summary: c++ hangs (and finally crashes) compiling Mozilla with optimization
Status: CLOSED DUPLICATE of bug 28385
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: gcc   
(Show other bugs)
Version: 7.0
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: David Lawrence
Depends On:
TreeView+ depends on / blocked
Reported: 2001-03-16 02:17 UTC by Need Real Name
Modified: 2007-04-18 16:32 UTC (History)
0 users

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

Attachments (Terms of Use)
Preprocessed source file that hangs the compiler. (416.85 KB, text/plain)
2001-03-16 02:19 UTC, Need Real Name
no flags Details
Script to compile nsStyleContext.ii and cause the hang. (227 bytes, text/plain)
2001-03-16 02:20 UTC, Need Real Name
no flags Details

Description Need Real Name 2001-03-16 02:17:18 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.4.2-ac11 i686)

Trying to compile Mozilla CVS with gcc-2.96-69, when it reaches
nsStyleContext.cpp in mozilla/content/base/src, c++ hangs for many minutes
and finally crashes trying to allocate a huge amount of memory.

Running "top" we can see cc1plus using a lot of CPU and slowly growing in
memory usage. The output from the make is the following:

c++ -o nsStyleContext.o -c -DOSTYPE=\"Linux2.4\" -DOJI -D_IMPL_NS_LAYOUT  
-I../../../dist/include -I../../../dist/include      -I./../../events/src
-I./../../html/base/src -I./../../html/style/src -I./../../xul/base/src
-I./../../xul/content/src  -I/usr/X11R6/include   -fPIC 
-I/usr/X11R6/include -fno-rtti -fno-exceptions -Wall -Wconversion
-Wpointer-arith -Wbad-function-cast -Wcast-align -Woverloaded-virtual
-Wsynth -pedantic -Wno-long-long -pipe -pthread -O2  -DNDEBUG -DTRIMMED
-I/usr/X11R6/include -DMOZILLA_CLIENT -include ../../../config-defs.h
-Wp,-MD,.deps/nsStyleContext.pp nsStyleContext.cpp
nsStyleContext.cpp: In method `nsresult StyleContextImpl::RemapStyle
(nsIPresContext *, int)':
nsStyleContext.cpp:3487: warning: unused variable `nsresult rv'
nsStyleContext.cpp:3573: warning: unused variable `nsresult rv'
nsStyleContext.cpp:3617: warning: unused variable `nsresult result'

Cannot allocate 1911936300 bytes after allocating 15497788 bytes
make[3]: *** [nsStyleContext.o] Error 1

If I remove the "-O2" from the build line and compile unoptimized, the file
builds correctly. This is one of two files in the Mozilla source that has
this problem (the other is
mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp) although I have
seen a similar problem in the past building avifile.

Reproducible: Always
Steps to Reproduce:
Take the included nsStyleContext.ii file and compile it with the command
line in the "compile" file.

Actual Results:  c++ will hang and eventually crash for lack of memory.	

Expected Results:  The file should compile and produce a usable
nsStyleContext.o file.

Comment 1 Need Real Name 2001-03-16 02:19:07 UTC
Created attachment 12782 [details]
Preprocessed source file that hangs the compiler.

Comment 2 Need Real Name 2001-03-16 02:20:19 UTC
Created attachment 12783 [details]
Script to compile nsStyleContext.ii and cause the hang.

Comment 3 Need Real Name 2001-03-16 02:24:02 UTC
I forgot to note - I attached to cc1plus with gdb and got a stack trace of where
it was - the stack trace was

#0  0x80af8ca in error ()
#1  0x80685d5 in error ()
... (144 more occurrences of error() with different addresses)
#146 0x804c116 in error ()
#147 0x804fd85 in error ()
#148 0x4003ef31 in __libc_start_main (main=0x804f730 <error+19008>, argc=21, 
    ubp_av=0xbffff61c, init=0x80491d8, fini=0x82b1f3c <textdomain+10524>, 
    rtld_fini=0x4000e274 <_dl_fini>, stack_end=0xbffff614)
    at ../sysdeps/generic/libc-start.c:129

Comment 4 Jakub Jelinek 2001-03-16 10:36:34 UTC

*** This bug has been marked as a duplicate of 28385 ***

Comment 5 Need Real Name 2001-03-17 02:28:14 UTC
I have confirmed that this is fixed in the 2.96-78 from rawhide.

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