re PR c++/24302 (anonymous global union segfault with g++ 3.4.x)

PR c++/24302
	* toplev.c (check_global_declaration_1): Robustify.
	PR c++/24302
	* g++.dg/warn/Wunused-12.C: New test.

From-SVN: r105222
This commit is contained in:
Mark Mitchell 2005-10-11 06:19:55 +00:00 committed by Mark Mitchell
parent 18c75543a8
commit eb2182e299
4 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2005-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/24277
* pt.c (instantiate_decl): Call finish_static_data_member_decl for
static data members.
2005-10-10 Giovanni Bajo <giovannibajo@gcc.gnu.org>
Mark Mitchell <mark@codesourcery.com>

View File

@ -1,5 +1,8 @@
2005-10-10 Mark Mitchell <mark@codesourcery.com>
PR c++/24302
* g++.dg/warn/Wunused-12.C: New test.
PR c++/23437
* g++.dg/template/arg4.C: New test.

View File

@ -0,0 +1,8 @@
// PR c++/24302
// { dg-options "-Wunused" }
static union
{
unsigned char FLT4ARR[4];
float FLT4;
}; // { dg-warning "used" }

View File

@ -836,7 +836,7 @@ check_global_declaration_1 (tree decl)
&& ! TREE_USED (decl)
/* The TREE_USED bit for file-scope decls is kept in the identifier,
to handle multiple external decls in different scopes. */
&& ! TREE_USED (DECL_NAME (decl))
&& ! (DECL_NAME (decl) && TREE_USED (DECL_NAME (decl)))
&& ! DECL_EXTERNAL (decl)
&& ! TREE_PUBLIC (decl)
/* A volatile variable might be used in some non-obvious way. */