From: jsm28 Date: Thu, 5 Feb 2009 01:18:02 +0000 (+0000) Subject: PR c/35435 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c34f8a7844e5dc3703f4333015af25aaabec7b0e;p=thirdparty%2Fgcc.git PR c/35435 * c-common.c (handle_tls_model_attribute): Ignore attribute for non-VAR_DECLs without checking DECL_THREAD_LOCAL_P. testsuite: * gcc.dg/tls/diag-6.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@143948 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index a06b164620a2..178c665a9392 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-02-05 Joseph Myers + + PR c/35435 + * c-common.c (handle_tls_model_attribute): Ignore attribute for + non-VAR_DECLs without checking DECL_THREAD_LOCAL_P. + 2009-02-04 Tobias Grosser * graphite.c (bb_in_sese_p, sese_build_livein_liveouts_use, diff --git a/gcc/c-common.c b/gcc/c-common.c index 81992d4672fb..dbc9676b099b 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -6263,7 +6263,7 @@ handle_tls_model_attribute (tree *node, tree name, tree args, *no_add_attrs = true; - if (!DECL_THREAD_LOCAL_P (decl)) + if (TREE_CODE (decl) != VAR_DECL || !DECL_THREAD_LOCAL_P (decl)) { warning (OPT_Wattributes, "%qE attribute ignored", name); return NULL_TREE; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e4f877dc47ae..74238e38a6ee 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-02-05 Joseph Myers + + PR c/35435 + * gcc.dg/tls/diag-6.c: New test. + 2009-02-04 H.J. Lu AVX Programming Reference (January, 2009) diff --git a/gcc/testsuite/gcc.dg/tls/diag-6.c b/gcc/testsuite/gcc.dg/tls/diag-6.c new file mode 100644 index 000000000000..71b0b95244ed --- /dev/null +++ b/gcc/testsuite/gcc.dg/tls/diag-6.c @@ -0,0 +1,8 @@ +/* Invalid tls_model attributes. PR 35435. */ +/* { dg-require-effective-target tls } */ + +int v __attribute__((tls_model("initial-exec"))); /* { dg-warning "attribute ignored" } */ +typedef int X __attribute__((tls_model("initial-exec"))); /* { dg-warning "attribute ignored" } */ +void f(int x __attribute__((tls_model("initial-exec")))); /* { dg-warning "attribute ignored" } */ +__thread int a __attribute__((tls_model(1))); /* { dg-error "tls_model argument not a string" } */ +__thread int b __attribute__((tls_model("unknown"))); /* { dg-error "tls_model argument must be one of" } */