* decl2.c (get_guard): Don't use the same comdat group as the decl.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154965
138bc75d-0d04-0410-961f-
82ee72b054a4
2009-12-03 Jason Merrill <jason@redhat.com>
2009-12-03 Jason Merrill <jason@redhat.com>
+ PR c++/41611
+ * decl2.c (get_guard): Don't use the same comdat group as the decl.
+
PR c++/42266
* cvt.c (convert_from_reference): Do nothing if TREE_TYPE is null.
PR c++/42266
* cvt.c (convert_from_reference): Do nothing if TREE_TYPE is null.
TREE_STATIC (guard) = TREE_STATIC (decl);
DECL_COMMON (guard) = DECL_COMMON (decl);
DECL_COMDAT (guard) = DECL_COMDAT (decl);
TREE_STATIC (guard) = TREE_STATIC (decl);
DECL_COMMON (guard) = DECL_COMMON (decl);
DECL_COMDAT (guard) = DECL_COMDAT (decl);
- DECL_COMDAT_GROUP (guard) = DECL_COMDAT_GROUP (decl);
+ if (DECL_ONE_ONLY (decl))
+ make_decl_one_only (guard, cxx_comdat_group (guard));
if (TREE_PUBLIC (decl))
DECL_WEAK (guard) = DECL_WEAK (decl);
DECL_VISIBILITY (guard) = DECL_VISIBILITY (decl);
if (TREE_PUBLIC (decl))
DECL_WEAK (guard) = DECL_WEAK (decl);
DECL_VISIBILITY (guard) = DECL_VISIBILITY (decl);
2009-12-03 Jason Merrill <jason@redhat.com>
2009-12-03 Jason Merrill <jason@redhat.com>
+ PR c++/41611
+ * g++.dg/abi/guard2.C: New.
+
PR c++/42266
* g++.dg/cpp0x/variadic97.C: New.
PR c++/42266
* g++.dg/cpp0x/variadic97.C: New.
--- /dev/null
+// PR c++/41611
+// Test that the guard gets its own COMDAT group.
+// { dg-final { scan-assembler "_ZGVZN1A1fEvE1i,comdat" { target i?86-*-* x86_64-*-* } } }
+
+struct A {
+ static int f()
+ {
+ static int &i = *new int();
+ return i;
+ }
+};
+
+int main()
+{
+ return A::f();
+}