Bug 43600 - Segmentation fault for large C file (24MB)
Summary: Segmentation fault for large C file (24MB)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.1
: P3 normal
Target Milestone: 4.4.4
Assignee: Richard Biener
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-31 11:56 UTC by Adam Husar
Modified: 2010-03-31 21:46 UTC (History)
1 user (show)

See Also:
Host: x86_64-linux-gnu
Target:
Build:
Known to work: 4.3.4 4.4.4 4.5.0
Known to fail: 4.4.2 4.4.3
Last reconfirmed: 2010-03-31 12:23:51


Attachments
testing C file (322.18 KB, application/zip)
2010-03-31 11:57 UTC, Adam Husar
Details
valgrind report (1.29 KB, application/octet-stream)
2010-03-31 11:57 UTC, Adam Husar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Husar 2010-03-31 11:56:37 UTC
For my generated C file that has 24MB, gcc fails after 11 seconds 
with:

gcc: Internal error: Segmentation fault (program cc1)
Please submit a full bug report.

Fedora 11 64-bit, Pentium Quad Core, 2.83GHz, 4GB memory,
gcc 4.4.1

$ uname -a
Linux 2.6.30.9-99.fc11.x86_64 #1 SMP Tue Nov 17 21:30:38 EST 2009 x86_64 x86_64 x86_64 GNU/Linux

Source file and valgrind report are added as attachment.
Comment 1 Adam Husar 2010-03-31 11:57:20 UTC
Created attachment 20263 [details]
testing C file
Comment 2 Adam Husar 2010-03-31 11:57:43 UTC
Created attachment 20264 [details]
valgrind report
Comment 3 Adam Husar 2010-03-31 11:59:40 UTC
Other details, e.g. why I want to compile so huge file, can be found here: http://n3.nabble.com/Memory-and-time-consumption-for-larger-files-td683717.html#a683717
Comment 4 Richard Biener 2010-03-31 12:23:51 UTC
needs -DCLANG to build.  cgraph verification takes ages, so make sure to
turn off checking.  The issue is:

Program received signal SIGSEGV, Segmentation fault.
0x00000000007b9f6e in cgraph_output_in_order ()
    at /space/rguenther/src/svn/gcc-4_4-branch/gcc/cgraphunit.c:1148
1148      memset (nodes, 0, size);
(gdb) p size
$1 = 13406704
(gdb) l
1143      struct cgraph_asm_node *pa;
1144
1145      max = cgraph_order;
1146      size = max * sizeof (struct cgraph_order_sort);
1147      nodes = (struct cgraph_order_sort *) alloca (size);
1148      memset (nodes, 0, size);
1149
1150      varpool_analyze_pending_decls ();
1151
1152      for (pf = cgraph_nodes; pf; pf = pf->next)

well.  We shouldn't try to allocate so much memory on stack.

Mine.
Comment 5 Richard Biener 2010-03-31 13:20:41 UTC
Subject: Bug 43600

Author: rguenth
Date: Wed Mar 31 13:20:19 2010
New Revision: 157867

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157867
Log:
2010-03-31  Richard Guenther  <rguenther@suse.de>

	PR middle-end/43600
	* cgraphunit.c (cgraph_output_in_order): Do not allocate
	temporary data on stack.

Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/cgraphunit.c

Comment 6 Richard Biener 2010-03-31 13:23:45 UTC
Subject: Bug 43600

Author: rguenth
Date: Wed Mar 31 13:23:17 2010
New Revision: 157868

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=157868
Log:
2010-03-31  Richard Guenther  <rguenther@suse.de>

	PR middle-end/43600
	* cgraphunit.c (cgraph_output_in_order): Do not allocate
	temporary data on stack.

Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/cgraphunit.c

Comment 7 Richard Biener 2010-03-31 13:25:31 UTC
Fixed.