Fix PR c/35435 (invalid tls_model attributes ICE)
Joseph S. Myers
joseph@codesourcery.com
Thu Feb 5 01:29:00 GMT 2009
This patch fixes PR 35435, a regression ICE with invalid tls_model
attributes.
Bootstrapped with no regressions on i686-pc-linux-gnu. Applied to
mainline. I'll test for 4.3 branch and apply there as well subject to
test results.
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.
testsuite:
2009-02-05 Joseph Myers <joseph@codesourcery.com>
PR c/35435
* gcc.dg/tls/diag-6.c: New test.
Index: c-common.c
===================================================================
--- c-common.c (revision 143922)
+++ c-common.c (working copy)
@@ -6263,7 +6263,7 @@ handle_tls_model_attribute (tree *node,
*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;
Index: testsuite/gcc.dg/tls/diag-6.c
===================================================================
--- testsuite/gcc.dg/tls/diag-6.c (revision 0)
+++ testsuite/gcc.dg/tls/diag-6.c (revision 0)
@@ -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" } */
--
Joseph S. Myers
joseph@codesourcery.com
More information about the Gcc-patches
mailing list