diff options
author | Jakub Jelinek <jakub@redhat.com> | 2008-09-26 07:09:29 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2008-09-26 07:09:29 +0200 |
commit | e7b012c0443aa04b8b128e64fa1a5e193c8cc340 (patch) | |
tree | b02577ee4e89f768c0114466de99d6a7f83a9969 /gcc/c-common.c | |
parent | 83d48fad1f3dc5d869fd3f567293ef12bf495392 (diff) | |
download | gcc-e7b012c0443aa04b8b128e64fa1a5e193c8cc340.zip gcc-e7b012c0443aa04b8b128e64fa1a5e193c8cc340.tar.gz gcc-e7b012c0443aa04b8b128e64fa1a5e193c8cc340.tar.bz2 |
re PR c/37645 (ICE with weakref attribute)
PR c/37645
* c-common.c (handle_weakref_attribute): Ignore the attribute unless
the decl is a VAR_DECL or FUNCTION_DECL.
* gcc.dg/pr37645.c: New test.
From-SVN: r140680
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 680b9b5..5d69211 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -6131,7 +6131,9 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, /* We must ignore the attribute when it is associated with local-scoped decls, since attribute alias is ignored and many such symbols do not even have a DECL_WEAK field. */ - if (decl_function_context (*node) || current_function_decl) + if (decl_function_context (*node) + || current_function_decl + || (TREE_CODE (*node) != VAR_DECL && TREE_CODE (*node) != FUNCTION_DECL)) { warning (OPT_Wattributes, "%qE attribute ignored", name); *no_add_attrs = true; |