On Thu, Feb 26, 2015 at 07:28:02PM +0100, Kai Tietz wrote: > Hi, > > This patch addresses the reported ICE about #pragma weak used on > declarations not var or function. > > ChangeLog > > 2015-02-26 Kai Tietz <kti...@redhat.com> > > * c-pragma.c (handle_pragma_weak): Do not try to creat
"create" > weak/alias of declarations > not being function, or variable declarations. "functions" > --- 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) Use !VAR_OR_FUNCTION_DECL_P. > + { > + error ("weak declaration of %q+D not allowed", decl); > + return; > + } I think that shouldn't be an error, merely a warning. Thus, use GCC_BAD2 ("..., ignored", decl); instead? Also please add a testcase. Marek