re PR c++/77285 (extern thread_local linkage)
authorJakub Jelinek <jakub@redhat.com>
Fri, 18 Nov 2016 21:56:50 +0000 (22:56 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 18 Nov 2016 21:56:50 +0000 (22:56 +0100)
PR c++/77285
* mangle.c (mangle_tls_init_fn, mangle_tls_wrapper_fn): Call
check_abi_tags.

* g++.dg/tls/pr77285-1.C: New test.
* g++.dg/tls/pr77285-2.C: New test.

From-SVN: r242607

gcc/cp/ChangeLog
gcc/cp/mangle.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/tls/pr77285-1.C [new file with mode: 0644]
gcc/testsuite/g++.dg/tls/pr77285-2.C [new file with mode: 0644]

index 68431bb7aaf081f4ad269a18d941b41c17d98344..c26f1455a7aacd21491f1d60d34067c7eddcbe2d 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/77285
+       * mangle.c (mangle_tls_init_fn, mangle_tls_wrapper_fn): Call
+       check_abi_tags.
+
 2016-11-18  Jason Merrill  <jason@redhat.com>
 
        PR c++/67631 - list-init and explicit conversions
index a4a2444ebfbc467c591c782701cd9c76aa3e5e8e..4fffe0bb4d2d40fe2f32f2901a5e5638b81f6bf7 100644 (file)
@@ -4301,6 +4301,7 @@ mangle_guard_variable (const tree variable)
 tree
 mangle_tls_init_fn (const tree variable)
 {
+  check_abi_tags (variable);
   start_mangling (variable);
   write_string ("_ZTH");
   write_guarded_var_name (variable);
@@ -4315,6 +4316,7 @@ mangle_tls_init_fn (const tree variable)
 tree
 mangle_tls_wrapper_fn (const tree variable)
 {
+  check_abi_tags (variable);
   start_mangling (variable);
   write_string (TLS_WRAPPER_PREFIX);
   write_guarded_var_name (variable);
index 729c2e980e0ca60d4a2d0dba04bdc0db499d3d81..c94d808a1debe8cce8542ed3efd33fd8464c489c 100644 (file)
@@ -1,3 +1,9 @@
+2016-11-18  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/77285
+       * g++.dg/tls/pr77285-1.C: New test.
+       * g++.dg/tls/pr77285-2.C: New test.
+
 2016-11-18  Jeff Law  <law@redhat.com>
 
        PR target/25112
diff --git a/gcc/testsuite/g++.dg/tls/pr77285-1.C b/gcc/testsuite/g++.dg/tls/pr77285-1.C
new file mode 100644 (file)
index 0000000..d8f69b2
--- /dev/null
@@ -0,0 +1,7 @@
+// { dg-do link { target c++11 } }
+// { dg-require-effective-target tls }
+// { dg-additional-sources pr77285-2.C }
+
+struct __attribute__((abi_tag("tag"))) X { ~X () {} int i = 0; };
+thread_local X var1;
+X var2;
diff --git a/gcc/testsuite/g++.dg/tls/pr77285-2.C b/gcc/testsuite/g++.dg/tls/pr77285-2.C
new file mode 100644 (file)
index 0000000..bac273a
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/77285
+// { dg-do compile { target c++11 } }
+// { dg-require-effective-target tls }
+// { dg-final { scan-assembler "_Z4var1B3tag" } }
+// { dg-final { scan-assembler "_Z4var2B3tag" } }
+// { dg-final { scan-assembler "_ZTH4var1B3tag" } }
+// { dg-final { scan-assembler "_ZTW4var1B3tag" } }
+
+struct __attribute__((abi_tag("tag"))) X { ~X () {} int i = 0; };
+extern thread_local X var1;
+extern X var2;
+
+int
+main ()
+{
+ return var1.i + var2.i;
+}