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.
Created attachment 12782 [details] Preprocessed source file that hangs the compiler.
Created attachment 12783 [details] Script to compile nsStyleContext.ii and cause the hang.
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
*** This bug has been marked as a duplicate of 28385 ***
I have confirmed that this is fixed in the 2.96-78 from rawhide.