Happen with gcc40 snapshots 4.0.0 20050109 (experimental) and the snapshots in
past months.
gcc configured with --disable-nls --with-system-zlib --program-suffix=40
--disable-shared --prefix=/usr/local x86_64-portbld-freebsd6.0
ICE with -O2,-O3, or -O1 -funit-at-a-time
It works well with -O0 -funit-at-a-time or -O3 -fno-unit-at-a-time
ICE does not happed in gcc 3.4.2
(gdb) r f.c -dumpbase f.c -da -auxbase f -O1 -funit-at-a-time
Starting program: /usr/local/libexec/gcc/x86_64-portbld-freebsd6.0/4.0.0/cc1 f.c
-dumpbase f.c -da -auxbase f -O1 -funit-at-a-time
g
f
Analyzing compilation unit
Performing intraprocedural optimizations
Assembling functions:
f
Program received signal SIGSEGV, Segmentation fault.
0x0000000000453246 in c_types_compatible_p (x=0x0, y=0x80f47a90)
at .././..//gcc-4.0-20050109/gcc/c-objc-common.c:273
273 return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
(gdb) l
268 }
269
270 int
271 c_types_compatible_p (tree x, tree y)
272 {
273 return comptypes (TYPE_MAIN_VARIANT (x), TYPE_MAIN_VARIANT (y));
274 }
(gdb) where
#0 0x0000000000453246 in c_types_compatible_p (x=0x0, y=0x80f47a90)
at .././..//gcc-4.0-20050109/gcc/c-objc-common.c:273
#1 0x000000000047718e in tree_ssa_useless_type_conversion_1 (
outer_type=0x80f47a90, inner_type=0x0)
at .././..//gcc-4.0-20050109/gcc/tree-ssa.c:739
#2 0x00000000004a2fa1 in may_propagate_copy (dest=0x81058b40, orig=0x810584b0)
at .././..//gcc-4.0-20050109/gcc/tree-ssa-copy.c:67
#3 0x00000000004bf515 in propagate_to_outgoing_edges (walk_data=Variable
"walk_data" is not available.
)
at .././..//gcc-4.0-20050109/gcc/tree-ssa-dom.c:2317
#4 0x00000000004c6a87 in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x810541a0) at .././..//gcc-4.0-20050109/gcc/domwalk.c:195
#5 0x00000000004c6abe in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x81054750) at .././..//gcc-4.0-20050109/gcc/domwalk.c:205
#6 0x00000000004c6abe in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x810545b0) at .././..//gcc-4.0-20050109/gcc/domwalk.c:205
#7 0x00000000004c6abe in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x81054270) at .././..//gcc-4.0-20050109/gcc/domwalk.c:205
#8 0x00000000004c6abe in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x8105c000) at .././..//gcc-4.0-20050109/gcc/domwalk.c:205
#9 0x00000000004c6abe in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x810540d0) at .././..//gcc-4.0-20050109/gcc/domwalk.c:205
#10 0x00000000004c6abe in walk_dominator_tree (walk_data=0x7fffffffe3d0,
bb=0x81052d00) at .././..//gcc-4.0-20050109/gcc/domwalk.c:205
#11 0x00000000004c01e9 in tree_ssa_dominator_optimize ()
at .././..//gcc-4.0-20050109/gcc/tree-ssa-dom.c:426
#12 0x000000000047b146 in execute_pass_list (pass=0xb62180)
at .././..//gcc-4.0-20050109/gcc/tree-optimize.c:526
#13 0x000000000047b1db in execute_pass_list (pass=0xa2e200)
at .././..//gcc-4.0-20050109/gcc/tree-optimize.c:564
#14 0x000000000047b439 in tree_rest_of_compilation (fndecl=0x8104cea0)
at .././..//gcc-4.0-20050109/gcc/tree-optimize.c:662
#15 0x0000000000419783 in c_expand_body (fndecl=0x8104cea0)
at .././..//gcc-4.0-20050109/gcc/c-decl.c:6424
--
Summary: ICE with -O1 -funit-at-a-time
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: tree-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: kcwu at csie dot org
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19360