[PATCH] Fix COMDAT group of thunks
Jakub Jelinek
jakub@redhat.com
Fri Feb 25 19:44:00 GMT 2005
On Fri, Feb 25, 2005 at 01:50:42PM +0000, Nathan Sidwell wrote:
> >--- gcc/cp/decl.c.jj 2005-02-24 22:20:24.000000000 +0100
> >+++ gcc/cp/decl.c 2005-02-25 11:36:53.729017752 +0100
> >@@ -11117,6 +11117,17 @@ cxx_comdat_group (tree decl)
> > else
> > name = DECL_ASSEMBLER_NAME (decl);
> >
> >+ if (DECL_THUNK_P (decl))
> >+ {
> >+ /* If TARGET_USE_LOCAL_THUNK_ALIAS_P, use_thunk puts the thunk
> >+ into the same section as the target function. In that case
> >+ we must return target's name. */
> >+ tree target = THUNK_TARGET (decl);
> >+ if (TARGET_USE_LOCAL_THUNK_ALIAS_P (target)
> >+ && DECL_SECTION_NAME (target) != NULL
> >+ && DECL_ONE_ONLY (target))
> >+ name = DECL_ASSEMBLER_NAME (target);
>
> With covariancy THUNK_TARGET can itself be a thunk. Do you need an
> additional
> if (THUNK_P (target))
> target = THUNK_TARGET (target)
> here? (and in use_thunk?)
How do you think should a testcase for that look like?
I have tried g++.dg/abi/covariant*.C and on none of the these
cxx_comdat_group saw a DECL_THUNK_P (decl) && DECL_THUNK_P (THUNK_TARGET (decl))
Neither on:
// PR c++/20206
// { dg-do run }
// { dg-options "-O0" }
void
bar (int x)
{
asm ("" : : "g" (x));
}
struct S { S () {}; virtual ~S () {}; };
struct T { virtual T *foo (int) {}; };
struct V : virtual S, virtual T {};
struct V v;
struct U : public S, public T
{
bool a;
U () {}
virtual ~U () {}
virtual V *foo (int x)
{
switch (x)
{
case 12:
break;
case 9:
bar (7);
break;
case 10:
bar (12);
break;
case 4:
bar (18);
break;
case 2:
bar (26);
break;
}
return &v;
}
};
U u;
int
main ()
{
}
Jakub
More information about the Gcc-patches
mailing list