This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch c-family]: Fix Bug 35330 - [4.8/4.9/5 regression] ICE with invalid pragma weak
- From: Kai Tietz <ktietz70 at googlemail dot com>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Thu, 26 Feb 2015 19:28:02 +0100
- Subject: [patch c-family]: Fix Bug 35330 - [4.8/4.9/5 regression] ICE with invalid pragma weak
- Authentication-results: sourceware.org; auth=none
Hi,
This patch addresses the reported ICE about #pragma weak used on
declarations not var or function.
ChangeLog
2015-02-26 Kai Tietz <ktietz@redhat.com>
* c-pragma.c (handle_pragma_weak): Do not try to creat
weak/alias of declarations
not being function, or variable declarations.
Bootstrapped and regression tested on x86_64-unknown-linux-gnu. Ok for apply?
Regards,
Kai
Index: c-pragma.c
===================================================================
--- c-pragma.c (Revision 221019)
+++ c-pragma.c (Arbeitskopie)
@@ -392,6 +392,11 @@ handle_pragma_weak (cpp_reader * ARG_UNUSED (dummy
decl = identifier_global_value (name);
if (decl && DECL_P (decl))
{
+ if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL)
+ {
+ error ("weak declaration of %q+D not allowed", decl);
+ return;
+ }
apply_pragma_weak (decl, value);
if (value)
{