* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95619
138bc75d-0d04-0410-961f-
82ee72b054a4
+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>
* call.c, class.c, cp-tree.h, decl2.c, error.c, init.c, mangle.c,
/* For all other DECLs, the COMDAT group is the mangled name of the
declaration itself. */
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);
}
+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>
* gfortran.dg/e_d_fmt.f90: New test.
--- /dev/null
+// 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 ()
+{
+}
--- /dev/null
+// 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 ()
+{
+}