> > here we have decl and its local alias: > (gdb) p debug_tree (sect->named.decl) > <var_decl 70f7d060 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si > type <array_type 70dd8840 > type <pointer_type 700f5840 __vtbl_ptr_type type <function_type > 700f57e0> > unsigned SI > size <integer_cst 70006498 constant 32> > unit size <integer_cst 700064b0 constant 4> > align 32 symtab 45 alias set 3 canonical type 700f5840 > pointer_to_this <pointer_type 700f5900>> > BLK > size <integer_cst 708002d0 constant 320> > unit size <integer_cst 708000d8 constant 40> > align 32 symtab 0 alias set 3 canonical type 70dd8840 > domain <integer_type 701a78a0 type <integer_type 7001d000 sizetype> > type_6 SI size <integer_cst 70006498 32> unit size <integer_cst > 700064b0 4> > align 32 symtab 0 alias set -1 canonical type 701a78a0 precision > 32 min <integer_cst 700064c8 0> max <integer_cst 701a5b88 9>> > pointer_to_this <pointer_type 71272d80>> > readonly addressable used public static tree_1 tree_5 tree_6 ignored weak > in_system_header virtual decl_5 SI file > /home/jh/trunk/c/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/fstream line 444 > col 11 size <integer_cst 708002d0 320> unit size <integer_cst 708000d8 40> > user align 32 context <record_type 701eb000 basic_ifstream> initial > <constructor 70f63680> > > (mem/u/c:SI (symbol_ref/i:SI > ("_ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si") [flags 0x82] <var_decl > 70f7d060 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si>) [3 > _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si+0 S40 A32])> > $6 = 10 > (gdb) p debug_tree (decl) > <var_decl 714174e0 > _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69 > type <array_type 70dd8840 > type <pointer_type 700f5840 __vtbl_ptr_type type <function_type > 700f57e0> > unsigned SI > size <integer_cst 70006498 constant 32> > unit size <integer_cst 700064b0 constant 4> > align 32 symtab 45 alias set 3 canonical type 700f5840 > pointer_to_this <pointer_type 700f5900>> > BLK > size <integer_cst 708002d0 constant 320> > unit size <integer_cst 708000d8 constant 40> > align 32 symtab 0 alias set 3 canonical type 70dd8840 > domain <integer_type 701a78a0 type <integer_type 7001d000 sizetype> > type_6 SI size <integer_cst 70006498 32> unit size <integer_cst > 700064b0 4> > align 32 symtab 0 alias set -1 canonical type 701a78a0 precision > 32 min <integer_cst 700064c8 0> max <integer_cst 701a5b88 9>> > pointer_to_this <pointer_type 71272d80>> > readonly addressable used static tree_1 tree_5 tree_6 ignored > in_system_header decl_5 SI file > /home/jh/trunk/c/powerpc-ibm-aix7.1.0.0/libstdc++-v3/include/fstream line 444 > col 11 size <integer_cst 708002d0 320> unit size <integer_cst 708000d8 40> > user align 32 context <record_type 701eb000 basic_ifstream> > > > $7 = 10 > > > Perhaps get_vairable_section should look for alias target, since that is the > decl really deciding on the section? Richard?
This is patch that makes get_variable_section to look through the aliases Index: varasm.c =================================================================== --- varasm.c (revision 210914) +++ varasm.c (working copy) @@ -1083,6 +1083,9 @@ { addr_space_t as = ADDR_SPACE_GENERIC; int reloc; + symtab_node *snode = symtab_get_node (decl); + if (snode) + decl = symtab_alias_ultimate_target (snode)->decl; if (TREE_TYPE (decl) != error_mark_node) as = TYPE_ADDR_SPACE (TREE_TYPE (decl)); For AIX it makes the bug go away and I eventually get: /tmp//ccyAATFr.s: line 30042: 1252-001 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69 is defined already. /tmp//ccyAATFr.s: line 30125: 1252-001 _ZTCSt14basic_ofstreamIcSt11char_traitsIcEE0_So.localalias.71 is defined already. /tmp//ccyAATFr.s: line 30164: 1252-001 _ZTCSt13basic_fstreamIcSt11char_traitsIcEE8_So.localalias.75 is defined already. /tmp//ccyAATFr.s: line 30223: 1252-001 _ZTCSt13basic_fstreamIcSt11char_traitsIcEE0_Si.localalias.74 is defined already. /tmp//ccyAATFr.s: line 30263: 1252-001 _ZTCSt14basic_ofstreamIwSt11char_traitsIwEE0_St13basic_ostreamIwS1_E.localalias.80 is defined already. /tmp//ccyAATFr.s: line 30323: 1252-001 _ZTCSt13basic_fstreamIwSt11char_traitsIwEE8_St13basic_ostreamIwS1_E.localalias.84 is defined already. /tmp//ccyAATFr.s: line 30388: 1252-001 _ZTCSt14basic_ifstreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E.localalias.78 is defined already. /tmp//ccyAATFr.s: line 30436: 1252-001 _ZTCSt13basic_fstreamIwSt11char_traitsIwEE0_St13basic_istreamIwS1_E.localalias.83 is defined already. David, this looks like a bug in the AIX target output macros. I get: .set _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69,_ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si (this is correct since localalias is really an alias) _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si.localalias.69: .space 40 _ZTCSt14basic_ifstreamIcSt11char_traitsIcEE0_Si: ... This is wrong, since we should not try to out the variable at least if I read AIX assembly correctly. varpool has explicit test to not output any aliases, so perhaps this is a bug in wrapup_globals and AIX output macros. I will try to track more after my teaching tonight. Honza