public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/42317]  New: [4.5 Regression] Issues with comdat virtual dtors
@ 2009-12-07  9:15 jakub at gcc dot gnu dot org
  2009-12-07  9:16 ` [Bug c++/42317] " jakub at gcc dot gnu dot org
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: jakub at gcc dot gnu dot org @ 2009-12-07  9:15 UTC (permalink / raw)
  To: gcc-bugs

cat > T.C <<\EOF
// { dg-do link }
// { dg-options "-O0" }
// { dg-additional-sources "T-aux.cc" }

#include "T.h"

D::D (int x) : C (x) {}

int
main ()
{
}
EOF
cat > T.h <<\EOF
struct A
{
  A ();
  ~A ();
};

struct B
{
  A b;
  virtual void mb ();
  B (int);
  virtual ~B ();
};

struct C : public B
{
  virtual void mc ();
  C (int);
  ~C ();
};

inline C::~C () {}

struct D : public C
{
  A d;
  D (int);
  ~D ();
};
EOF
cat > T-aux.cc <<\EOF
#include "T.h"

A::A () {}
A::~A () {}

void B::mb () {}
B::B (int) {}
B::~B () {}

void C::mc () {}
C::C (int x) : B (x) {}

D::~D () {}
EOF
g++ -o T T.c T-aux.cc
fails on powerpc64-linux with:
`C::~C()' referenced in section `.data.rel.ro._ZTV1C[vtable for C]' of
/tmp/ccnVbxT3.o: defined in discarded section `_ZN1CD5Ev' of /tmp/ccnVbxT3.o

While this doesn't fail to link on e.g. x86_64-linux, even there it is buggy:
grep ZN1CD.*comdat T.s; echo $?; grep ZN1CD.*comdat T-aux.s
.section.text._ZN1CD2Ev,"axG",@progbits,_ZN1CD5Ev,comdat
0
.section.text._ZN1CD2Ev,"axG",@progbits,_ZN1CD5Ev,comdat
.section.text._ZN1CD0Ev,"axG",@progbits,_ZN1CD5Ev,comdat

Deleting dtor wasn't emitted in T.s (no vtable is emitted there either).

So I'm afraid we either need to add further restrictions on when we actually do
optimize same body dtors (but have no idea at this point what that restriction
would be, appart from disabling the optimization for virtual destructors,
Jason, any ideas?), or would need to accept some bloat from time to time and
change cgraph to force in also the deleting dtor if samebody complete/base dtor
aliases are emitted in the D5 group.


-- 
           Summary: [4.5 Regression] Issues with comdat virtual dtors
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jakub at gcc dot gnu dot org
GCC target triplet: powerpc64-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42317


^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-12-26 11:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-07  9:15 [Bug c++/42317] New: [4.5 Regression] Issues with comdat virtual dtors jakub at gcc dot gnu dot org
2009-12-07  9:16 ` [Bug c++/42317] " jakub at gcc dot gnu dot org
2009-12-07 12:56 ` jakub at gcc dot gnu dot org
2009-12-07 12:56 ` jakub at gcc dot gnu dot org
2009-12-07 12:57 ` jakub at gcc dot gnu dot org
2009-12-08  8:56 ` debian-gcc at lists dot debian dot org
2009-12-08  8:58 ` debian-gcc at lists dot debian dot org
2009-12-08  9:03 ` jakub at gcc dot gnu dot org
2009-12-08 12:36 ` doko at ubuntu dot com
2009-12-08 12:37 ` debian-gcc at lists dot debian dot org
2009-12-10 21:59 ` jakub at gcc dot gnu dot org
2009-12-11 23:41 ` hjl at gcc dot gnu dot org
2009-12-26 11:03 ` paolo dot carlini at oracle dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).