This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR c/26993: fix weakref ICE on malformed input
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 05 Apr 2006 01:33:50 -0300
- Subject: PATCH: PR c/26993: fix weakref ICE on malformed input
This patch fixes a bug introduced when weakrefs switched from extern
to static, so it only affects the trunk. Bootstrapped on
amd64-linux-gnu. Ok to install?
:ADDPATCH c/weakref:
for gcc/ChangeLog
from 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.
Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c.orig 2006-04-04 14:33:29.000000000 -0300
+++ gcc/c-common.c 2006-04-04 14:36:37.000000000 -0300
@@ -4807,6 +4807,16 @@ handle_weakref_attribute (tree *node, tr
{
tree attr = NULL_TREE;
+ /* We must ignore the attribute when it is associated with
+ local-scoped decls, since attribute alias is ignored and, more
+ importantly, such symbols do not 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. */
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Secretary for FSF Latin America http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}