re PR lto/53808 (Undefined symbol when building a library with lto)
authorJason Merrill <jason@redhat.com>
Tue, 19 Aug 2014 17:29:41 +0000 (13:29 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 19 Aug 2014 17:29:41 +0000 (13:29 -0400)
PR lto/53808
PR c++/61659
* decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger
comdat_linkage.

From-SVN: r214177

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.dg/abi/spec1.C [new file with mode: 0644]

index b366a4f429aa3a2e1b6d3a1188e165fdaa252e64..c60682e17872e6a8c7e7c48d26efc27634e9d98d 100644 (file)
@@ -1,3 +1,10 @@
+2014-08-19  Jason Merrill  <jason@redhat.com>
+
+       PR lto/53808
+       PR c++/61659
+       * decl.c (maybe_commonize_var): Don't use DECL_COMDAT to trigger
+       comdat_linkage.
+
 2014-08-19  Gerald Pfeifer  <gerald@pfeifer.com>
 
        * class.c (contains_empty_class_p): Remove.
index 92a6dbc96c7b591183ddc53d288d1987bf5b9b42..cc54ccace4293dbe8639b43e41944c38e0495986 100644 (file)
@@ -5099,10 +5099,6 @@ maybe_commonize_var (tree decl)
            }
        }
     }
-  else if (DECL_LANG_SPECIFIC (decl) && DECL_COMDAT (decl))
-    /* Set it up again; we might have set DECL_INITIAL since the last
-       time.  */
-    comdat_linkage (decl);
 }
 
 /* Issue an error message if DECL is an uninitialized const variable.  */
diff --git a/gcc/testsuite/g++.dg/abi/spec1.C b/gcc/testsuite/g++.dg/abi/spec1.C
new file mode 100644 (file)
index 0000000..153c0cf
--- /dev/null
@@ -0,0 +1,4 @@
+// { dg-final { scan-assembler-not "weak" } }
+
+template <class T> struct A { static int i; };
+template<> int A<int>::i = 42;