]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/55800
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 16:25:55 +0000 (16:25 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 31 Jan 2014 16:25:55 +0000 (16:25 +0000)
* decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@207360 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/decl2.c
gcc/testsuite/g++.dg/tls/thread_local8.C [new file with mode: 0644]

index 0909bf1441711f20f845e25a88671f4f3b931436..4f38a6df366fc038f82e0a8a89283919cfd53453 100644 (file)
@@ -1,3 +1,8 @@
+2014-01-31  Jason Merrill  <jason@redhat.com>
+
+       PR c++/55800
+       * decl2.c (get_tls_init_fn): Copy DECL_EXTERNAL from the variable.
+
 2014-01-31  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/59082
index b2103c802df73eaafe4e672fb9da3bf798f57bfa..22165915b92489b8f042f303cc61a20659e3efee 100644 (file)
@@ -2949,7 +2949,7 @@ get_tls_init_fn (tree var)
       TREE_PUBLIC (fn) = TREE_PUBLIC (var);
       DECL_ARTIFICIAL (fn) = true;
       DECL_COMDAT (fn) = DECL_COMDAT (var);
-      DECL_EXTERNAL (fn) = true;
+      DECL_EXTERNAL (fn) = DECL_EXTERNAL (var);
       if (DECL_ONE_ONLY (var))
        make_decl_one_only (fn, cxx_comdat_group (fn));
       if (TREE_PUBLIC (var))
diff --git a/gcc/testsuite/g++.dg/tls/thread_local8.C b/gcc/testsuite/g++.dg/tls/thread_local8.C
new file mode 100644 (file)
index 0000000..206e7b3
--- /dev/null
@@ -0,0 +1,11 @@
+// PR c++/55800
+// { dg-options "-std=c++11" }
+// { dg-require-alias "" }
+// { dg-final { scan-assembler "_ZTH12foo_instance" { target tls_native } } }
+
+struct foo
+{
+  foo();
+};
+
+thread_local foo foo_instance;