This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/77316] Unnecessary template copy constructor weak symbol emitted in wrong section


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77316

--- Comment #3 from Roland Dreier <rbd at debian dot org> ---
I managed to simplify the test case a bit by hand.  The significant thing seems
to be "decltype(nullptr)" - if I change that to, say, void*, then I don't get
the spurious symbol.

$ cat b.cpp
template <typename _Alloc> class vector {
public:
  vector();
  vector(const _Alloc &) {}
  void operator=(vector) { vector a(get_allocator()); }
  _Alloc get_allocator();
};

template <typename>
struct allocator_affinity {};

typedef vector<allocator_affinity<decltype(nullptr)>> addr_list_t;

addr_list_t ad;
void startt() {
  ad = addr_list_t();
}

$ g++-5 -std=c++11 -o b.o -c b.cpp

$ objdump -C -t b.o

b.o:     file format elf64-x86-64

SYMBOL TABLE:
0000000000000000 l    df *ABS*  0000000000000000 b.cpp
0000000000000000 l    d  .text  0000000000000000 .text
0000000000000000 l    d  .data  0000000000000000 .data
0000000000000000 l    d  .bss   0000000000000000 .bss
0000000000000000 l    d  .text._ZN6vectorI18allocator_affinityIDnEEaSES2_      
0000000000000000 .text._ZN6vectorI18allocator_affinityIDnEEaSES2_
0000000000000000 l    d  .text._ZN6vectorI18allocator_affinityIDnEEC2ERKS1_    
0000000000000000 .text._ZN6vectorI18allocator_affinityIDnEEC2ERKS1_
000000000000002f l     F .text  000000000000002a
__static_initialization_and_destruction_0(int, int)
0000000000000059 l     F .text  0000000000000015 _GLOBAL__sub_I_ad
0000000000000000 l    d  .init_array    0000000000000000 .init_array
0000000000000000 l    d  .note.GNU-stack        0000000000000000
.note.GNU-stack
0000000000000000 l    d  .eh_frame      0000000000000000 .eh_frame
0000000000000000 l       .group 0000000000000000
vector<allocator_affinity<decltype(nullptr)>
>::vector(allocator_affinity<decltype(nullptr)> const&)
0000000000000000 l    d  .comment       0000000000000000 .comment
0000000000000000 l    d  .group 0000000000000000 .group
0000000000000000 l    d  .group 0000000000000000 .group
0000000000000000 g     O .bss   0000000000000001 ad
0000000000000000 g     F .text  000000000000002f startt()
0000000000000000         *UND*  0000000000000000
vector<allocator_affinity<decltype(nullptr)> >::vector()
0000000000000000  w    F .text._ZN6vectorI18allocator_affinityIDnEEaSES2_      
000000000000002e vector<allocator_affinity<decltype(nullptr)>
>::operator=(vector<allocator_affinity<decltype(nullptr)> >)
0000000000000000         *UND*  0000000000000000
vector<allocator_affinity<decltype(nullptr)> >::get_allocator()
0000000000000000  w    F .text._ZN6vectorI18allocator_affinityIDnEEC2ERKS1_    
000000000000000f vector<allocator_affinity<decltype(nullptr)>
>::vector(allocator_affinity<decltype(nullptr)> const&)
0000000000000000  w    F .text._ZN6vectorI18allocator_affinityIDnEEaSES2_      
000000000000002e _ZN6vectorI18allocator_affinityIDnEEaSES3_
0000000000000000  w    F .text._ZN6vectorI18allocator_affinityIDnEEC2ERKS1_    
000000000000000f vector<allocator_affinity<decltype(nullptr)>
>::vector(allocator_affinity<decltype(nullptr)> const&)
0000000000000000  w    F .text._ZN6vectorI18allocator_affinityIDnEEC2ERKS1_    
000000000000000f vector<allocator_affinity<decltype(nullptr)>
>::vector(vector<allocator_affinity<decltype(nullptr)> > const&)
0000000000000000  w    F .text._ZN6vectorI18allocator_affinityIDnEEC2ERKS1_    
000000000000000f vector<allocator_affinity<decltype(nullptr)>
>::vector(vector<allocator_affinity<decltype(nullptr)> > const&)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]