segfault in gcc/tree-cfgcleanup.c:156

Bernhard Fischer rep.nop@aon.at
Fri Oct 14 10:22:00 GMT 2005


[please keep me CCed]

Hi,

GNU C version 4.1.0 20051014 (experimental) (i686-linux-gnu)
compiled by GNU C version 4.0.2 20050808 (prerelease) (Ubuntu 4.0.1-4ubuntu9).

I'm seeing this with clean, current head:
1) unit-at-a-time, nocombine nowhole-program:

2) no-unit-at-a-time, -combine, -fwhole-program:
  is apparently the same (num_in_fnames is > 1, gcc doesn't warn that it
  will ignore no-unit-at-a-time.. see attached patch. Please cp it to
  gcc-patches if you think it's sensible)

Thus only looking at 1):
Program received signal SIGSEGV, Segmentation fault.
0x08317abf in cleanup_tree_cfg () at
../../../src/gcc/gcc/tree-cfgcleanup.c:156
156	  FOR_EACH_BB (bb)
(gdb) p bb
No symbol "bb" in current context.
(gdb) p cfun
$1 = (struct function *) 0x0
(gdb) bt
#0  0x08317abf in cleanup_tree_cfg () at
../../../src/gcc/gcc/tree-cfgcleanup.c:156
#1  0x0830b095 in execute_one_pass (pass=0x8491d00) at
../../../src/gcc/gcc/passes.c:827
#2  0x0830b195 in execute_pass_list (pass=0x8491d00) at
../../../src/gcc/gcc/passes.c:859
#3  0x0830b20a in execute_ipa_pass_list (pass=0x8491d40) at
../../../src/gcc/gcc/passes.c:881
#4  0x08343bc4 in cgraph_optimize () at
../../../src/gcc/gcc/cgraphunit.c:1221
#5  0x08056282 in c_write_global_declarations () at
../../../src/gcc/gcc/c-decl.c:7645
#6  0x082eef46 in toplev_main (argc=0, argv=0xbfd16cf4) at
../../../src/gcc/gcc/toplev.c:1003
#7  0xb7de2ea2 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#8  0x08049ae1 in _start () at ../sysdeps/i386/elf/start.S:119
(gdb) bt f
#0  0x08317abf in cleanup_tree_cfg () at
../../../src/gcc/gcc/tree-cfgcleanup.c:156
	retval = 0 '\0'
	changed = 0 '\0'
#1  0x0830b095 in execute_one_pass (pass=0x8491d00) at
../../../src/gcc/gcc/passes.c:827
	todo = 2958257104
#2  0x0830b195 in execute_pass_list (pass=0x8491d00) at
../../../src/gcc/gcc/passes.c:859
No locals.
#3  0x0830b20a in execute_ipa_pass_list (pass=0x8491d40) at
../../../src/gcc/gcc/passes.c:881
	node = (struct cgraph_node *) 0xb79b51a0
#4  0x08343bc4 in cgraph_optimize () at
../../../src/gcc/gcc/cgraphunit.c:1221
No locals.
#5  0x08056282 in c_write_global_declarations () at
../../../src/gcc/gcc/c-decl.c:7645
	tmp = 0xb7ce8000
	flags = -1076773718
	stream = Variable "stream" is not available.



arguments passed to gcc:
-o a.elf  -Os -Wall -Wstrict-prototypes -Wshadow -version -falign-functions=0 -falign-jumps=0 -falign-loops=0 -fomit-frame-pointer -funit-at-a-time -fno-mem-report -fno-time-report source001.c ... sources999.c

I take it that changing FOR_EACH_BB_FN to
(FN)?(FN)->cfg->x_entry_block_ptr->next_bb:NULL etc is not the correct
approach. Looks like we shouldn't get there in the first place.

Ideas?


-------------- next part --------------
Index: gcc/c-opts.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/c-opts.c,v
retrieving revision 1.149
diff -u -r1.149 c-opts.c
--- gcc/c-opts.c	20 Sep 2005 20:31:30 -0000	1.149
+++ gcc/c-opts.c	14 Oct 2005 09:59:03 -0000
@@ -966,7 +966,11 @@
   /* If we are given more than one input file, we must use
      unit-at-a-time mode.  */
   if (num_in_fnames > 1)
-    flag_unit_at_a_time = 1;
+    {
+      if (flag_unit_at_a_time < 1)
+         warning(0, "-fno-unit-at-a-time ignored with more than one filename");
+      flag_unit_at_a_time = 1;
+    }
 
   /* Default to ObjC sjlj exception handling if NeXT runtime.  */
   if (flag_objc_sjlj_exceptions < 0)


More information about the Gcc-help mailing list