GCC Bugzilla has been upgraded from version 4.4.9 to 5.0rc3. If you see any problem, please report it to bug 64968.
Bug 12440 - [3.3 Regression] gcc 3.3.1 on i386 linux 2.4.22 crashes during compilation of quicktime4linux 2.0.0
Summary: [3.3 Regression] gcc 3.3.1 on i386 linux 2.4.22 crashes during compilation of...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: rtl-optimization (show other bugs)
Version: 3.3.1
: P2 normal
Target Milestone: 3.3.3
Assignee: Zdenek Dvorak
URL:
Keywords: compile-time-hog, memory-hog, patch
: 12780 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-09-29 08:41 UTC by Fritz Reichmann
Modified: 2004-01-29 04:43 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work: 2.95.3
Known to fail:
Last reconfirmed: 2004-01-02 04:03:04


Attachments
The compiler flags with which the compiler is invoced (461 bytes, text/plain)
2003-09-29 08:44 UTC, Fritz Reichmann
Details
The C code produrcing the crash (2.14 KB, text/plain)
2003-09-29 08:45 UTC, Fritz Reichmann
Details
Include file which is loaded (6.31 KB, text/plain)
2003-09-29 08:47 UTC, Fritz Reichmann
Details
Include file which is loaded (1.50 KB, text/plain)
2003-09-29 08:47 UTC, Fritz Reichmann
Details
Code after preprocessor ran (9.54 KB, text/plain)
2003-09-29 08:49 UTC, Fritz Reichmann
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Fritz Reichmann 2003-09-29 08:41:27 UTC
The compiler crashes during compilation of the quicktime4linux library. I have stripped 
out the relevant files and will attached them to this report. Provoke the crash by calling: 
 
> gcc --save-temps -c `cat ./c_flags`  cmodel_default.c -o i686/cmodel_default.o 
gcc: Internal error: Killed (program cc1) 
Please submit a full bug report. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
The files in the directory are: 
fritz@linux:~/quicktime4linux-2.0.0/bla > ls 
c_flags           cmodel_default.i  cmodel_permutation.h 
cmodel_default.c  cmodel_default.s  colormodels.h 
 
This is information about the compiler: 
fritz@linux:~/quicktime4linux-2.0.0/bla > gcc -v 
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs 
Configured with: ./configure --prefix=/usr 
Thread model: posix 
gcc version 3.3.1 
 
and the underlying OS: 
> uname -a 
Linux linux 2.4.22 #6 Wed Sep 24 15:01:32 CEST 2003 i686 unknown 
fritz@linux:~/quicktime4linux-2.0.0/bla > nasm -v 
NASM version 0.98.38 compiled on Sep 29 2003
Comment 1 Fritz Reichmann 2003-09-29 08:44:47 UTC
Created attachment 4853 [details]
The compiler flags with which the compiler is invoced

The file c_flags contains the C compiler flags:

gcc --save-temps -c `cat ./c_flags`  cmodel_default.c -o i686/cmodel_default.o
Comment 2 Fritz Reichmann 2003-09-29 08:45:59 UTC
Created attachment 4854 [details]
The C code produrcing the crash

This is the C-Code producing the crash, when called with:

gcc --save-temps -c `cat ./c_flags`  cmodel_default.c -o i686/cmodel_default.o
Comment 3 Fritz Reichmann 2003-09-29 08:47:04 UTC
Created attachment 4855 [details]
Include file which is loaded

This file is included by cmodel_default.c
Comment 4 Fritz Reichmann 2003-09-29 08:47:59 UTC
Created attachment 4856 [details]
Include file which is loaded

This file is included by colormodels.h
Comment 5 Fritz Reichmann 2003-09-29 08:49:16 UTC
Created attachment 4857 [details]
Code after preprocessor ran

This file was written with the "--save-temps" option which is suggested in the
bug report howto.

gcc --save-temps -c `cat ./c_flags`  cmodel_default.c -o i686/cmodel_default.o
Comment 6 Fritz Reichmann 2003-09-29 08:52:24 UTC
I wanted to attach cmodel_default.s as well, which was produced by the --save-temps 
options which is suggested in the bug reporting howto. But this file is empty: 
 
fritz@linux:~/quicktime4linux-2.0.0/bla > ls -l 
total 376 
-rw-r--r--    1 fritz    users         946 Sep 29 10:26 c_flags 
-rw-r--r--    1 fritz    users       31080 Sep 29 10:26 cmodel_default.c 
-rw-r--r--    1 fritz    users      248559 Sep 29 10:28 cmodel_default.i 
-rw-r--r--    1 fritz    users           0 Sep 29 10:28 cmodel_default.s 
-rw-r--r--    1 fritz    users       78097 Sep 29 10:26 cmodel_permutation.h 
-rw-r--r--    1 fritz    users        4119 Sep 29 10:27 colormodels.h 
 
Fritz 
 
Comment 7 Falk Hueffner 2003-09-29 08:57:54 UTC
Out of memory problem. To me, it looks like the test case is simply too large
to be compiled with full optimization and inlining. I don't think there's much we 
can do about that, but I'll leave it open for now, maybe somebody else finds
something particularly memory-eating in this test case.
Comment 8 Fritz Reichmann 2003-09-29 09:00:31 UTC
After playing with the compiler options in c_flags I found out that the error does not 
occur when the 
-fmessage-length=0 
flag is deleted. 
 
Fritz 
 
Comment 9 Fritz Reichmann 2003-09-29 09:07:57 UTC
Subject: Re:  gcc 3.3.1 on i386 linux 2.4.22 crashes during compilation of quicktime4linux 2.0.0

That is well possible. I notice a general system slow down during compiler crash and a 
lot of harddisk activity which might be the swapping. The mashine is a 256MB laptop, 
btw. 
 
Leaving the bug as-is is fine to me. I turned off some of the the flags, and now it 
compiles fine. That is enough for me. 
 
Fritz 
 
Zitiere falk at debian dot org <gcc-bugzilla@gcc.gnu.org>: 
 
> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* 
> gcc-bugs@gcc.gnu.org. 
>  
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12440 
>  
>  
>  
> ------- Additional Comments From falk at debian dot org  2003-09-29 
> 08:57 ------- 
> Out of memory problem. To me, it looks like the test case is simply too 
> large 
> to be compiled with full optimization and inlining. I don't think 
> there's much we  
> can do about that, but I'll leave it open for now, maybe somebody else 
> finds 
> something particularly memory-eating in this test case. 
>  
>  
>  
>  
> ------- You are receiving this mail because: ------- 
> You reported the bug, or are watching the reporter. 
>  
>  
Comment 10 Andrew Pinski 2003-10-02 18:07:45 UTC
GCC uses about 350Megs of memory for compiling this.
Comment 11 Andrew Pinski 2004-01-02 04:03:03 UTC
This memory problem is caused by the loop_optimize phase and the memory usage is 
greater than 500MB.
Comment 12 Andrew Pinski 2004-01-02 04:08:45 UTC
*** Bug 12780 has been marked as a duplicate of this bug. ***
Comment 13 Andrew Pinski 2004-01-02 04:10:40 UTC
From the dup bug:

Confirmed: 
 
 (...) 
 transfer_YUV422_to_YUV420P 
 transfer_YUV422_to_YUV422 
 cmodel_default 
 
Analyzing compilation unit 
Performing intraprocedural optimizations 
Assembling functions: 
 cmodel_default 
 {Main zone GC 225104k -> 501k} 
cc1: out of memory allocating 33292 bytes after a total of 368948640 bytes 
Comment 14 Andrew Pinski 2004-01-10 19:41:30 UTC
Zdenek could you look at this one too, as this is another loop optimization problem that 
causes memory problems.
Comment 15 Zdenek Dvorak 2004-01-10 23:07:24 UTC
Subject: Re:  [3.3/3.4 Regression] gcc 3.3.1 on i386 linux 2.4.22 crashes during compilation of quicktime4linux 2.0.0

Hello,

> ------- Additional Comments From pinskia at gcc dot gnu dot org  2004-01-10 19:41 -------
> Zdenek could you look at this one too, as this is another loop
> optimization problem that causes memory problems.

the problem is in the old loop optimizer, for which I am not really an
expert.

But it actually is easy to analyse: the loop optimizer consumes memory for
temporary expressions during iv discovery and optimizations (and gc is
only called on the end of the pass), which becomes a problem in case
there is a function with hundreds of nice small loops.  This patch
prevents the memory explosion by adding gc after each loop; I am just
regtesting it.

Zdenek

Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.485
diff -c -3 -p -r1.485 loop.c
*** loop.c	6 Jan 2004 16:51:17 -0000	1.485
--- loop.c	10 Jan 2004 23:04:56 -0000
*************** Software Foundation, 59 Temple Place - S
*** 65,70 ****
--- 65,71 ----
  #include "insn-flags.h"
  #include "optabs.h"
  #include "cfgloop.h"
+ #include "ggc.h"
  
  /* Not really meaningful values, but at least something.  */
  #ifndef SIMULTANEOUS_PREFETCHES
*************** loop_optimize (rtx f, FILE *dumpfile, in
*** 534,540 ****
        struct loop *loop = &loops->array[i];
  
        if (! loop->invalid && loop->end)
! 	scan_loop (loop, flags);
      }
  
    end_alias_analysis ();
--- 535,544 ----
        struct loop *loop = &loops->array[i];
  
        if (! loop->invalid && loop->end)
! 	{
! 	  scan_loop (loop, flags);
! 	  ggc_collect ();
! 	}
      }
  
    end_alias_analysis ();
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.1217
diff -c -3 -p -r1.1217 Makefile.in
*** Makefile.in	9 Jan 2004 01:18:35 -0000	1.1217
--- Makefile.in	10 Jan 2004 23:05:01 -0000
*************** value-prof.o : value-prof.c $(CONFIG_H) 
*** 1676,1682 ****
  loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \
     insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
     real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h cfgloop.h \
!    toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H)
  doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
     $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \
     cfgloop.h
--- 1676,1682 ----
  loop.o : loop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h $(LOOP_H) \
     insn-config.h $(REGS_H) hard-reg-set.h $(RECOG_H) $(EXPR_H) \
     real.h $(PREDICT_H) $(BASIC_BLOCK_H) function.h cfgloop.h \
!    toplev.h varray.h except.h cselib.h $(OPTABS_H) $(TM_P_H) $(GGC_H)
  doloop.o : doloop.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(RTL_H) flags.h \
     $(LOOP_H) $(EXPR_H) hard-reg-set.h $(BASIC_BLOCK_H) $(TM_P_H) toplev.h \
     cfgloop.h
Comment 16 Andrew Pinski 2004-01-14 03:44:15 UTC
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00837.html>.
Comment 17 CVS Commits 2004-01-20 16:56:03 UTC
Subject: Bug 12440

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	rakdver@gcc.gnu.org	2004-01-20 16:55:57

Modified files:
	gcc            : ChangeLog Makefile.in loop.c 

Log message:
	PR optimization/12440
	* loop.c: Include ggc.h.
	(loop_optimize): Run garbage collector between optimization of loops.
	* Makefile.in (loop.o): Add GGC_H dependency.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.2379&r2=2.2380
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&r1=1.1227&r2=1.1228
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&r1=1.488&r2=1.489

Comment 18 Andrew Pinski 2004-01-20 17:13:13 UTC
Fixed for 3.5 so no longer a 3.5 regression.
Comment 19 CVS Commits 2004-01-24 11:19:41 UTC
Subject: Bug 12440

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	rakdver@gcc.gnu.org	2004-01-24 11:19:38

Modified files:
	gcc            : loop.c 

Log message:
	PR optimization/12440
	* loop.c: Include ggc.h.
	(loop_optimize): Run garbage collector between optimization of loops.
	* Makefile.in (loop.o): Add GGC_H dependency.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.488&r2=1.488.2.1

Comment 20 Andrew Pinski 2004-01-24 15:16:08 UTC
Only a 3.3.3 regression now.
Comment 21 CVS Commits 2004-01-29 04:42:20 UTC
Subject: Bug 12440

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	gdr@gcc.gnu.org	2004-01-29 04:42:16

Modified files:
	gcc            : ChangeLog Makefile.in loop.c 

Log message:
	Backport from mainline
	
	2004-01-20  Zdenek Dvorak  <rakdver@atrey.karlin.mff.cuni.cz>
	
	PR optimization/12440
	* loop.c: Include ggc.h.
	(loop_optimize): Run garbage collector between optimization of
	loops.
	* Makefile.in (loop.o): Add GGC_H dependency.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.893&r2=1.16114.2.894
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/Makefile.in.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.958.2.17&r2=1.958.2.18
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/loop.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.433.2.12&r2=1.433.2.13

Comment 22 Gabriel Dos Reis 2004-01-29 04:43:06 UTC
Fixed with a backport from mainline.