Message ID | 20140527222049.GA31853@kam.mff.cuni.cz |
---|---|
State | New |
Headers | show |
On 05/27/14 23:20, Jan Hubicka wrote: >> >> 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. Any update? I've managed to generate a simple test case from libstdc++-v3/src/c++98/strstream.cc which reproduces the issue on ARM that Ramana has reported previously: template<class _CharT> struct char_traits; template<typename _CharT, typename _Traits> class basic_ios { }; template<typename _CharT, typename _Traits = char_traits<_CharT> > class basic_istream : virtual public basic_ios<_CharT, _Traits> { protected: int _M_gcount; virtual ~basic_istream() { } }; class istrstream : public basic_istream<char> { virtual ~istrstream(); }; istrstream::~istrstream() { } ------------------ CUT ------------------ With an arm-none-linux-gnueabi gcc configured as: ./gcc/configure --target=arm-none-linux-gnueabi --enable-gnu-indirect-function --enable-shared --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=softfp --with-arch=armv7-a (irrelevant parts omitted) With the following command line options: -fdata-sections -O2 -fPIC -S ./test.cpp We'll see ./test.cpp:17:7: error: istrstream::_ZTV10istrstream.localalias.0 causes a section type conflict with istrstream::_ZTV10istrstream class istrstream : public basic_istream<char> ^ ./test.cpp:17:7: note: 'istrstream::_ZTV10istrstream' was declared here Yufeng
> On 05/27/14 23:20, Jan Hubicka wrote: > >> > >>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. > > Any update? > > I've managed to generate a simple test case from > libstdc++-v3/src/c++98/strstream.cc which reproduces the issue on > ARM that Ramana has reported previously: Thanks, that is very useful! I will look into it today - I am teaching at evening, so first I need to prepare my class and will do it next. Honza
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));