diff options
author | Kai Tietz <ktietz@redhat.com> | 2015-02-27 11:44:43 +0100 |
---|---|---|
committer | Kai Tietz <ktietz@gcc.gnu.org> | 2015-02-27 11:44:43 +0100 |
commit | d1783ae53cfc5cea69de151a4df63dead33a0386 (patch) | |
tree | cccd444baeb8f19701371b711edd405a31aae37f | |
parent | 1310f119efaa7248016bcab2b3da6b83fc689c2d (diff) | |
download | gcc-d1783ae53cfc5cea69de151a4df63dead33a0386.zip gcc-d1783ae53cfc5cea69de151a4df63dead33a0386.tar.gz gcc-d1783ae53cfc5cea69de151a4df63dead33a0386.tar.bz2 |
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
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c-family/c-pragma.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/weak/weak-17.c | 5 |
4 files changed, 20 insertions, 0 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index ffa01c6..ca5a412 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +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-24 Thomas Schwinge <thomas@codesourcery.com> PR libgomp/64625 diff --git a/gcc/c-family/c-pragma.c b/gcc/c-family/c-pragma.c index 718a310..6894f0e 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) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3200f41..5ca86b1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-02-27 Kai Tietz <ktietz@redhat.com> + + PR c/35330 + * gcc.dg/weak/weak-17.c: New file. + 2015-02-27 Richard Biener <rguenther@suse.de> PR lto/65193 diff --git a/gcc/testsuite/gcc.dg/weak/weak-17.c b/gcc/testsuite/gcc.dg/weak/weak-17.c new file mode 100644 index 0000000..b4bda9b --- /dev/null +++ b/gcc/testsuite/gcc.dg/weak/weak-17.c @@ -0,0 +1,5 @@ +/* { dg-do compile } */ +/* { dg-require-weak "" } */ +#pragma weak int = foo + +/* { dg-warning "declaration of" "weak" { target *-*-* } 0 } */ |