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
This commit is contained in:
Kai Tietz 2015-02-27 11:44:43 +01:00 committed by Kai Tietz
parent 1310f119ef
commit d1783ae53c
4 changed files with 20 additions and 0 deletions

View File

@ -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

View File

@ -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)
{

View File

@ -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

View File

@ -0,0 +1,5 @@
/* { dg-do compile } */
/* { dg-require-weak "" } */
#pragma weak int = foo
/* { dg-warning "declaration of" "weak" { target *-*-* } 0 } */