On 10/09/2012 11:27 AM, Jason Merrill wrote:
FAIL: g++.dg/tls/thread_local7.C scan-assembler-not \\.data

I've changed this test to require native TLS.

FAIL: g++.dg/tls/static-1.C *

And I've fixed the compiler to not mess with thread_local wrappers on this test, since it uses __thread.

Tested x86_64-pc-linux-gnu, applying to trunk.

commit 3c317cba2f2b6100987ee720f7d7da76f5f43c19
Author: Jason Merrill <ja...@redhat.com>
Date:   Tue Oct 9 12:55:52 2012 -0400

    	* decl.c (grokdeclarator): Set DECL_GNU_TLS_P for static data
    	members, too.

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0b936ea..e78c664 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -10446,7 +10446,11 @@ grokdeclarator (const cp_declarator *declarator,
 		DECL_EXTERNAL (decl) = 1;
 
 		if (thread_p)
-		  DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+		  {
+		    DECL_TLS_MODEL (decl) = decl_default_tls_model (decl);
+		    if (declspecs->gnu_thread_keyword_p)
+		      DECL_GNU_TLS_P (decl) = true;
+		  }
 
 		if (constexpr_p && !initialized)
 		  {
diff --git a/gcc/testsuite/g++.dg/gomp/tls-5.C b/gcc/testsuite/g++.dg/gomp/tls-5.C
index 74e4faa..f1dcdae 100644
--- a/gcc/testsuite/g++.dg/gomp/tls-5.C
+++ b/gcc/testsuite/g++.dg/gomp/tls-5.C
@@ -1,6 +1,7 @@
 // The reference temp should be TLS, not normal data.
 // { dg-require-effective-target c++11 }
-// { dg-final { scan-assembler-not "\\.data" } }
+// { dg-require-alias }
+// { dg-final { scan-assembler-not "\\.data" { target tls_native } } }
 
 extern int&& ir;
 #pragma omp threadprivate (ir)
diff --git a/gcc/testsuite/g++.dg/tls/static2.C b/gcc/testsuite/g++.dg/tls/static2.C
new file mode 100644
index 0000000..ab688dd
--- /dev/null
+++ b/gcc/testsuite/g++.dg/tls/static2.C
@@ -0,0 +1,18 @@
+// { dg-final { scan-assembler-not "_ZTHN1A1iE" } }
+// { dg-final { scan-assembler-not "_ZTWN1A1iE" } }
+// { dg-require-effective-target tls }
+
+struct A
+{
+  static __thread int i;
+};
+
+int
+test ()
+{
+  if (A::i != 8)
+    return 1;
+
+  A::i = 17;
+  return 0;
+}
diff --git a/gcc/testsuite/g++.dg/tls/thread_local7.C b/gcc/testsuite/g++.dg/tls/thread_local7.C
index 77a1c05..f453b96 100644
--- a/gcc/testsuite/g++.dg/tls/thread_local7.C
+++ b/gcc/testsuite/g++.dg/tls/thread_local7.C
@@ -2,7 +2,7 @@
 // { dg-require-effective-target tls }
 
 // The reference temp should be TLS, not normal data.
-// { dg-final { scan-assembler-not "\\.data" } }
+// { dg-final { scan-assembler-not "\\.data" { target tls_native } } }
 
 void f()
 {

Reply via email to