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

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

From-SVN: r192366
This commit is contained in:
Jason Merrill 2012-10-11 11:13:20 -04:00 committed by Jason Merrill
parent e8548a47e1
commit e4cc27e5fb
6 changed files with 37 additions and 3 deletions

View File

@ -1,3 +1,8 @@
2012-10-11 Jason Merrill <jason@redhat.com>
* decl.c (grokdeclarator): Set DECL_GNU_TLS_P for static data
members, too.
2012-10-09 Dodji Seketeli <dodji@redhat.com>
PR c++/53540 - using fails to be equivalent to typedef

View File

@ -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)
{

View File

@ -1,3 +1,9 @@
2012-10-11 Jason Merrill <jason@redhat.com>
* g++.dg/gomp/tls-5.C: Require tls_native.
* g++.dg/tls/thread_local7.C: Require tls_native.
* g++.dg/tls/static2.C: New.
2012-10-11 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/36107

View File

@ -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)

View File

@ -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;
}

View File

@ -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()
{