summaryrefslogtreecommitdiff
path: root/gcc/c-family/c-pragma.c
diff options
context:
space:
mode:
authorKai Tietz <ktietz@redhat.com>2015-02-27 11:44:43 +0100
committerKai Tietz <ktietz@gcc.gnu.org>2015-02-27 11:44:43 +0100
commitd1783ae53cfc5cea69de151a4df63dead33a0386 (patch)
treecccd444baeb8f19701371b711edd405a31aae37f /gcc/c-family/c-pragma.c
parent1310f119efaa7248016bcab2b3da6b83fc689c2d (diff)
downloadgcc-d1783ae53cfc5cea69de151a4df63dead33a0386.tar.gz
re PR c/35330 (ICE with invalid pragma weak)
2015-02-27 Kai Tietz <ktietz@redhat.com> PR c/35330 * c-pragma.c (handle_pragma_weak): Do not try to create weak/alias of declarations not being function, or variable declarations. 2015-02-27 Kai Tietz <ktietz@redhat.com> PR c/35330 * gcc.dg/weak/weak-17.c: New file. From-SVN: r221053
Diffstat (limited to 'gcc/c-family/c-pragma.c')
-rw-r--r--gcc/c-family/c-pragma.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c
index 718a310cf50..6894f0e7c3d 100644
--- a/gcc/c-family/c-pragma.c
+++ b/gcc/c-family/c-pragma.c
@@ -392,6 +392,9 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy))
decl = identifier_global_value (name);
if (decl && DECL_P (decl))
{
+ if (!VAR_OR_FUNCTION_DECL_P (decl))
+ GCC_BAD2 ("%<#pragma weak%> declaration of %q+D not allowed,"
+ " ignored", decl);
apply_pragma_weak (decl, value);
if (value)
{