diff options
author | Alexandre Oliva <aoliva@redhat.com> | 2006-07-18 06:41:13 +0000 |
---|---|---|
committer | Alexandre Oliva <aoliva@gcc.gnu.org> | 2006-07-18 06:41:13 +0000 |
commit | e1cf56b1d989c6e50b4cd89b2956532588bd9881 (patch) | |
tree | 37cc37972a3fa0fb18d5b251d292e90f45e3399e /gcc/c-common.c | |
parent | e098f3a586a9aeee60f97def2bbe64ca080c13cc (diff) | |
download | gcc-e1cf56b1d989c6e50b4cd89b2956532588bd9881.zip gcc-e1cf56b1d989c6e50b4cd89b2956532588bd9881.tar.gz gcc-e1cf56b1d989c6e50b4cd89b2956532588bd9881.tar.bz2 |
re PR c/26993 (ICE on invalid code with weakref)
PR c/26993
* c-common.c (handle_weakref_attribute): Ignore attribute in
the same conditions the alias attribute is ignored.
From-SVN: r115545
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index 61bf12b..9c26061 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -4828,6 +4828,16 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, { tree attr = NULL_TREE; + /* 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) + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + return NULL_TREE; + } + /* The idea here is that `weakref("name")' mutates into `weakref, alias("name")', and weakref without arguments, in turn, implicitly adds weak. */ |