------- Comment #33 from amylaar at gcc dot gnu dot org 2010-07-08 01:00
-------
pop_labels_1 installs the LABEL_DECL of half in BLOCK_VARS:
Breakpoint 16, pop_labels_1 (slot=0xb7d86f94, data=0xb7d95068)
at ../../gcc/gcc/cp/decl.c:384
384 struct named_label_entry *ent = (struct named_label_entry *) *slot;
(gdb) n
387 pop_label (ent->label_decl, NULL_TREE);
(gdb)
391 TREE_CHAIN (ent->label_decl) = BLOCK_VARS (block);
If we are NOT generating debug info, this is cleared in
remove_unused_scope_block_p:
Hardware watchpoint 15: *$11
(gdb) cont
Continuing.
Hardware watchpoint 15: *$11
Old value = (tree) 0xb7cf9f18
New value = (tree) 0x0
remove_unused_scope_block_p (scope=0xb7d86fa4)
at ../../gcc/gcc/tree-ssa-live.c:427
427 for (t = &BLOCK_VARS (scope); *t; t = next)
Note this code in lines 478ff:
else if (debug_info_level == DINFO_LEVEL_NORMAL
|| debug_info_level == DINFO_LEVEL_VERBOSE)
;
else
{
*t = TREE_CHAIN (*t);
next = t;
}
But if we are generating debug info, this BLOCK_VARS setting remains untouched,
and copied in remap_block:
Breakpoint 14, remap_block (block=0xbfffee6c, id=0xbfffef0c)
at ../../gcc/gcc/tree-inline.c:616
616 BLOCK_VARS (new_block) = remap_decls (BLOCK_VARS (old_block),
(gdb) call debug_tree(old_block->block_vars)
There is no member named block_vars.
(gdb) call debug_tree(old_block->block.vars)
<label_decl 0xb7cf9f18 half
type <void_type 0xb7d00840 void asm_written VOID
align 8 symtab 0 alias set -1 canonical type 0xb7d00840
pointer_to_this <pointer_type 0xb7d008a0>>
VOID file t.c line 75 col 1
align 1 context <function_decl 0xb7d88900 ix86_expand_vector_init_general>
initial <error_mark 0xb7cf07e0>>
(gdb) p old_block->block.vars->common.chain
$21 = (tree) 0x0
to be copied later from expand_call_inline ...
We got this with debug info:
Breakpoint 12, expand_call_inline (fn=0xb7d88980)
at ../../gcc/gcc/tree-inline.c:3872
3872 if (DECL_INITIAL (fn))
(gdb) s
3873 prepend_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn),
id));
(gdb)
remap_blocks (block=0xb7d95750, id=0xbffff028)
at ../../gcc/gcc/tree-inline.c:634
634 if (!block)
(gdb) call debug_tree(block)
<block 0xb7d95750 used
vars <label_decl 0xb7d99738 half
type <void_type 0xb7d00840 void asm_written VOID
align 8 symtab 0 alias set -1 canonical type 0xb7d00840
pointer_to_this <pointer_type 0xb7d008a0>>
VOID file t.c line 75 col 1
align 1 context <function_decl 0xb7d88c00
_ZL31ix86_expand_vector_init_generalb12machine_modeP7rtx_defS1_.isra.0> initial
<error_mark 0xb7cf07e0> abstract_origin <label_decl 0xb7cf9f18 half>>
subblocks <block 0xb7d95784 used
vars <var_decl 0xb7d97780 ops type <array_type 0xb7d8cf00>
addressable used tree_1 decl_5 BLK file t.c line 61 col 13
size <integer_cst 0xb7d7f5a0 constant 1024>
unit size <integer_cst 0xb7d901c8 constant 128>
align 32 context <function_decl 0xb7d88c00
_ZL31ix86_expand_vector_init_generalb12machine_modeP7rtx_defS1_.isra.0>
abstract_origin <var_decl 0xb7d91060 ops> chain <var_decl 0xb7d977e0 n>>
supercontext <block 0xb7d95750>
subblocks <block 0xb7d957b8 used supercontext <block 0xb7d95784>
abstract_origin <block 0xb7d95000 used vars <var_decl 0xb7d914e0
n_words>
supercontext <block 0xb7d95034 used vars <var_decl 0xb7d91060
ops>
supercontext <block 0xb7d95068 used vars <label_decl
0xb7cf9f18 half> supercontext <function_decl 0xb7d88900
ix86_expand_vector_init_general> subblocks <block 0xb7d95034>> subblocks <block
0xb7d95000>>>> abstract_origin <block 0xb7d95034>> abstract_origin <block
0xb7d95068>>
and that gets the LABEL_DECL an expedited copy with a relatively low uid:
Hardware watchpoint 10: *$11
Old value = 1853
New value = 1877
0x086ee9cc in copy_node_stat (node=0xb7d99738) at ../../gcc/gcc/tree.c:966
966 DECL_UID (t) = next_decl_uid++;
(gdb) bt
#0 0x086ee9cc in copy_node_stat (node=0xb7d99738) at ../../gcc/gcc/tree.c:966
#1 0x087a315d in copy_decl_no_change (decl=0xb7d99738, id=0xbffff028)
at ../../gcc/gcc/tree-inline.c:4782
#2 0x087a427c in remap_decl (decl=0xb7d99738, id=0xbffff028)
at ../../gcc/gcc/tree-inline.c:288
#3 0x087a5534 in remap_decls (decls=<value optimized out>,
nonlocalized_list=0xb7d95940, id=0xbffff028)
at ../../gcc/gcc/tree-inline.c:557
#4 0x087a58db in remap_block (block=0xbfffef8c, id=0xbffff028)
at ../../gcc/gcc/tree-inline.c:616
#5 0x087a5a5e in remap_blocks (block=0xb7d95750, id=0xbffff028)
at ../../gcc/gcc/tree-inline.c:637
#6 0x087affe0 in expand_call_inline (fn=0xb7d88980)
at ../../gcc/gcc/tree-inline.c:3873
#7 gimple_expand_calls_inline (fn=0xb7d88980)
at ../../gcc/gcc/tree-inline.c:4057
#8 optimize_inline_calls (fn=0xb7d88980) at ../../gcc/gcc/tree-inline.c:4207
#9 0x0877e62d in cgraph_early_inlining () at ../../gcc/gcc/ipa-inline.c:1740
#10 0x084d57c7 in execute_one_pass (pass=0x8cdd8e8)
at ../../gcc/gcc/passes.c:1576
#11 0x084d5acd in execute_pass_list (pass=0x8cdd8e8)
at ../../gcc/gcc/passes.c:1631
#12 0x084d32d3 in do_per_function_toporder (
callback=0x84d5ab0 <execute_pass_list>, data=0x8c47c80)
at ../../gcc/gcc/passes.c:1154
#13 0x084d5b3d in execute_ipa_pass_list (pass=0x8c47b80)
at ../../gcc/gcc/passes.c:1931
#14 0x08775c84 in ipa_passes () at ../../gcc/gcc/cgraphunit.c:1854
#15 cgraph_optimize () at ../../gcc/gcc/cgraphunit.c:1923
#16 0x08776435 in cgraph_finalize_compilation_unit ()
at ../../gcc/gcc/cgraphunit.c:1171
#17 0x0818866a in cp_write_global_declarations ()
at ../../gcc/gcc/cp/decl2.c:3925
#18 0x0857c680 in compile_file (argc=21, argv=0xbffff494)
at ../../gcc/gcc/toplev.c:1024
#19 do_compile (argc=21, argv=0xbffff494) at ../../gcc/gcc/toplev.c:2377
#20 toplev_main (argc=21, argv=0xbffff494) at ../../gcc/gcc/toplev.c:2419
#21 0x082b062b in main (argc=21, argv=0xbffff494) at ../../gcc/gcc/main.c:35
whereas in the non-debug case, half is not in such a prominent position:
Breakpoint 11, expand_call_inline (fn=0xb7d88900)
at ../../gcc/gcc/tree-inline.c:3872
3872 if (DECL_INITIAL (fn))
(gdb) s
3873 prepend_lexical_block (id->block, remap_blocks (DECL_INITIAL (fn),
id));
(gdb)
remap_blocks (block=0xb7d946b4, id=0xbffff048)
at ../../gcc/gcc/tree-inline.c:634
634 if (!block)
(gdb) call debug_tree(block)
<block 0xb7d946b4 used
subblocks <block 0xb7d946e8 used
vars <var_decl 0xb7d95780 ops type <array_type 0xb7d8cf00>
addressable used tree_1 decl_5 BLK file t.c line 61 col 13
size <integer_cst 0xb7d7f5a0 constant 1024>
unit size <integer_cst 0xb7d8f168 constant 128>
align 32 context <function_decl 0xb7d88b80
_ZL31ix86_expand_vector_init_generalb12machine_modeP7rtx_defS1_.isra.0>
abstract_origin <var_decl 0xb7d90060 ops> chain <var_decl 0xb7d957e0 n>>
supercontext <block 0xb7d946b4>
subblocks <block 0xb7d9471c used supercontext <block 0xb7d946e8>
abstract_origin <block 0xb7d86f3c used
supercontext <block 0xb7d86f70 used vars <var_decl 0xb7d90060
ops>
supercontext <block 0xb7d86fa4 used supercontext
<function_decl 0xb7d88880 ix86_expand_vector_init_general> subblocks <block
0xb7d86f70>> subblocks <block 0xb7d86f3c>>>> abstract_origin <block
0xb7d86f70>> abstract_origin <block 0xb7d86fa4>>
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44832