From: Joseph Myers Date: Sat, 7 Feb 2009 00:32:37 +0000 (+0000) Subject: re PR c/35434 (ICE with attribute alias) X-Git-Tag: releases/gcc-4.4.0~624 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=feab5a6736e2b15d13d3d989b802f5da630a143d;p=thirdparty%2Fgcc.git re PR c/35434 (ICE with attribute alias) PR c/35434 * c-common.c (handle_alias_attribute): Disallow attribute for anything not a FUNCTION_DECL or VAR_DECL. testsuite: * gcc.dg/attr-alias-4.c: New test. From-SVN: r143998 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1e4501058744..8befe01fa8ce 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-02-06 Joseph Myers + + PR c/35434 + * c-common.c (handle_alias_attribute): Disallow attribute for + anything not a FUNCTION_DECL or VAR_DECL. + 2009-02-06 Janis Johnson PR c/39035 diff --git a/gcc/c-common.c b/gcc/c-common.c index dbc9676b099b..e7b90674d50a 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -6015,7 +6015,12 @@ handle_alias_attribute (tree *node, tree name, tree args, { tree decl = *node; - if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl)) + if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) + { + warning (OPT_Wattributes, "%qE attribute ignored", name); + *no_add_attrs = true; + } + else if ((TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl)) || (TREE_CODE (decl) != FUNCTION_DECL && TREE_PUBLIC (decl) && !DECL_EXTERNAL (decl)) /* A static variable declaration is always a tentative definition, diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf0aca756ee9..77e3ff7bd226 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2009-02-06 Joseph Myers + + PR c/35434 + * gcc.dg/attr-alias-4.c: New test. + 2009-02-06 Janis Johnson PR c/39035 diff --git a/gcc/testsuite/gcc.dg/attr-alias-4.c b/gcc/testsuite/gcc.dg/attr-alias-4.c new file mode 100644 index 000000000000..fb15a20bf843 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-alias-4.c @@ -0,0 +1,4 @@ +/* ICE on invalid alias attribute: PR 35434. */ +/* { dg-do compile } */ +/* { dg-options "" } */ +typedef int i __attribute__((alias("j"))); /* { dg-warning "ignored" } */