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.
From-SVN: r143963
+2009-02-05 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/35435
+ * c-common.c (handle_tls_model_attribute): Ignore attribute for
+ non-VAR_DECLs without checking DECL_THREAD_LOCAL_P.
+
2009-02-05 Richard Guenther <rguenther@suse.de>
Backport from mainline
*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;
+2009-02-05 Joseph Myers <joseph@codesourcery.com>
+
+ PR c/35435
+ * gcc.dg/tls/diag-6.c: New test.
+
2009-02-05 Richard Guenther <rguenther@suse.de>
Backport from mainline
--- /dev/null
+/* 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" } */