------- Comment #5 from rguenther at suse dot de 2010-09-17 13:26 ------- Subject: Re: ICE with -fwhopr/-flto when using strlen and strcat without previous declaration
On Fri, 17 Sep 2010, hubicka at gcc dot gnu dot org wrote: > > > ------- Comment #4 from hubicka at gcc dot gnu dot org 2010-09-17 13:13 > ------- > OK, the problem is that we stream two cgraph nodes. One for strlen function > and other for __bulitin_strlen. Decl of __bulitin_strlen have same asm name > as > strlen: > (gdb) p debug_tree (node->decl) > <function_decl 0x7ffff7f40000 strlen > type <function_type 0x7ffff7f3db28 > type <integer_type 0x7ffff7ed0690 long unsigned int public unsigned DI > size <integer_cst 0x7ffff7ebc7d0 constant 64> > unit size <integer_cst 0x7ffff7ebc7f8 constant 8> > align 64 symtab 0 alias set 4 canonical type 0x7ffff7ed0690 > precision 64 min <integer_cst 0x7ffff7ebc820 0> max <integer_cst > 0x7ffff7ebc7a8 > 18446744073709551615>> > QI > size <integer_cst 0x7ffff7ebc4d8 constant 8> > unit size <integer_cst 0x7ffff7ebc500 constant 1> > align 8 symtab 0 alias set -1 canonical type 0x7ffff7ee8888 > attributes <tree_list 0x7ffff7f3ac58 > purpose <identifier_node 0x7ffff7ecfc30 nonnull>> > arg-types <tree_list 0x7ffff7ee6640 value <pointer_type > 0x7ffff7ee3dc8> > chain <tree_list 0x7ffff7ebceb0 value <void_type 0x7ffff7ed0e70 > void>>> > pointer_to_this <pointer_type 0x7ffff5aebb28>> > addressable used nothrow public external built-in decl_2 decl_5 decl_6 QI > file <built-in> line 0 col 0 > align 8 built-in BUILT_IN_NORMAL:BUILT_IN_STRLEN attributes <tree_list > 0x7ffff7f3acf8> chain <function_decl 0x7ffff7f40100 __builtin_strncasecmp>> > $6 = void > (gdb) c > Continuing. > > Breakpoint 1, lto_output_node (set=0x7ffff7f98c00, vset=0x7ffff7f98c20) at > ../../gcc/lto-cgraph.c:416 > 416 boundary_p = !cgraph_node_in_set_p (node, set); > (gdb) c > Continuing. > > Breakpoint 1, lto_output_node (set=0x7ffff7f98c00, vset=0x7ffff7f98c20) at > ../../gcc/lto-cgraph.c:416 > 416 boundary_p = !cgraph_node_in_set_p (node, set); > (gdb) p debug_tree (node->decl) > <function_decl 0x7ffff7f3ef00 __builtin_strlen > type <function_type 0x7ffff7f3db28 > type <integer_type 0x7ffff7ed0690 long unsigned int public unsigned DI > size <integer_cst 0x7ffff7ebc7d0 constant 64> > unit size <integer_cst 0x7ffff7ebc7f8 constant 8> > align 64 symtab 0 alias set 4 canonical type 0x7ffff7ed0690 > precision 64 min <integer_cst 0x7ffff7ebc820 0> max <integer_cst > 0x7ffff7ebc7a8 > 18446744073709551615>> > QI > size <integer_cst 0x7ffff7ebc4d8 constant 8> > unit size <integer_cst 0x7ffff7ebc500 constant 1> > align 8 symtab 0 alias set -1 canonical type 0x7ffff7ee8888 > attributes <tree_list 0x7ffff7f3ac58 > purpose <identifier_node 0x7ffff7ecfc30 nonnull>> > arg-types <tree_list 0x7ffff7ee6640 value <pointer_type > 0x7ffff7ee3dc8> > chain <tree_list 0x7ffff7ebceb0 value <void_type 0x7ffff7ed0e70 > void>>> > pointer_to_this <pointer_type 0x7ffff5aebb28>> > nothrow public external built-in decl_6 QI file <built-in> line 0 col 0 > align 8 built-in BUILT_IN_NORMAL:BUILT_IN_STRLEN attributes <tree_list > 0x7ffff7f3ac80> chain <function_decl 0x7ffff7f40000 strlen>> > > and when reading back those two decls identify into single and thus also the > cgraph nodes. > > Richi: is that intended behaviour? No, we shouldn't stream them at all. Why do we even bother? And yes, same cgraph node is intended (one is an alias for the other). Maybe that's what we get "wrong" even in non-LTO mode? Do we have two different cgraph nodes for strlen vs. __builtin_strlen? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44246