Commit e1cf56b1 by Alexandre Oliva Committed by Alexandre Oliva

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
parent e098f3a5
2006-07-18 Alexandre Oliva <aoliva@redhat.com>
PR c/26993
* c-common.c (handle_weakref_attribute): Ignore attribute in
the same conditions the alias attribute is ignored.
2006-07-17 Carlos O'Donell <carlos@codesourcery.com> 2006-07-17 Carlos O'Donell <carlos@codesourcery.com>
* dbxout.c (dbxout_function_end): Do not increment scope_labelno. * dbxout.c (dbxout_function_end): Do not increment scope_labelno.
......
...@@ -4828,6 +4828,16 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args, ...@@ -4828,6 +4828,16 @@ handle_weakref_attribute (tree *node, tree ARG_UNUSED (name), tree args,
{ {
tree attr = NULL_TREE; 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, /* The idea here is that `weakref("name")' mutates into `weakref,
alias("name")', and weakref without arguments, in turn, alias("name")', and weakref without arguments, in turn,
implicitly adds weak. */ implicitly adds weak. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment