Commit 5591e5f9 by Jakub Jelinek Committed by Jakub Jelinek

re PR c++/20206 (COMDAT broken for C++ thunks)

	PR c++/20206
	* decl.c (cxx_comdat_group): Put thunks for
	TARGET_USE_LOCAL_THUNK_ALIAS_P (function) functions into the same
	comdat group as the thunk target.

	* g++.dg/opt/thunk2.C: New test.
	* g++.dg/opt/covariant1.C: New test.

From-SVN: r95619
parent c0d12712
2005-02-27 Jakub Jelinek <jakub@redhat.com>
PR c++/20206
* decl.c (cxx_comdat_group): Put thunks for
TARGET_USE_LOCAL_THUNK_ALIAS_P (function) functions into the same
comdat group as the thunk target.
2005-02-24 Volker Reichelt <reichelt@igpm.rwth-aachen.de> 2005-02-24 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
* call.c, class.c, cp-tree.h, decl2.c, error.c, init.c, mangle.c, * call.c, class.c, cp-tree.h, decl2.c, error.c, init.c, mangle.c,
......
...@@ -11115,7 +11115,22 @@ cxx_comdat_group (tree decl) ...@@ -11115,7 +11115,22 @@ cxx_comdat_group (tree decl)
/* For all other DECLs, the COMDAT group is the mangled name of the /* For all other DECLs, the COMDAT group is the mangled name of the
declaration itself. */ declaration itself. */
else else
name = DECL_ASSEMBLER_NAME (decl); {
while (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))
decl = target;
else
break;
}
name = DECL_ASSEMBLER_NAME (decl);
}
return IDENTIFIER_POINTER (name); return IDENTIFIER_POINTER (name);
} }
......
2005-02-27 Jakub Jelinek <jakub@redhat.com>
PR c++/20206
* g++.dg/opt/thunk2.C: New test.
* g++.dg/opt/covariant1.C: New test.
2005-02-27 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de> 2005-02-27 Tobias Schl"uter <tobias.schlueter@physik.uni-muenchen.de>
* gfortran.dg/e_d_fmt.f90: New test. * gfortran.dg/e_d_fmt.f90: New test.
......
// 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 ()
{
}
// PR c++/20206
// { dg-do run }
// { dg-options "-O0" }
void
bar (int x)
{
asm ("" : : "g" (x));
}
struct S { S () {}; virtual ~S () {}; };
struct T { virtual void foo (int) = 0; };
struct U : public S, public T
{
bool a;
U () {}
virtual ~U () {}
virtual void 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;
}
}
};
U u;
int
main ()
{
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment