diff options
author | Joseph Myers <joseph@codesourcery.com> | 2009-02-07 00:32:37 +0000 |
---|---|---|
committer | Joseph Myers <jsm28@gcc.gnu.org> | 2009-02-07 00:32:37 +0000 |
commit | feab5a6736e2b15d13d3d989b802f5da630a143d (patch) | |
tree | 565bd86f7c66276a4fe50b4ebe612007ef76459a /gcc/c-common.c | |
parent | 7d073491643591f4ad340c7b2cabbab37d3d0b7c (diff) | |
download | gcc-feab5a6736e2b15d13d3d989b802f5da630a143d.zip gcc-feab5a6736e2b15d13d3d989b802f5da630a143d.tar.gz gcc-feab5a6736e2b15d13d3d989b802f5da630a143d.tar.bz2 |
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
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r-- | gcc/c-common.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c index dbc9676..e7b9067 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, |