From: Mark Mitchell Date: Tue, 11 Oct 2005 06:19:55 +0000 (+0000) Subject: re PR c++/24302 (anonymous global union segfault with g++ 3.4.x) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=eb2182e29917811d90278a649a100e8bc8c1d13a;p=gcc.git 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 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 390384bc014..9fa7f0db3ca 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2005-10-10 Mark Mitchell + + PR c++/24277 + * pt.c (instantiate_decl): Call finish_static_data_member_decl for + static data members. + 2005-10-10 Giovanni Bajo Mark Mitchell diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9e9dc6e8224..aa4a66fdfd7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2005-10-10 Mark Mitchell + PR c++/24302 + * g++.dg/warn/Wunused-12.C: New test. + PR c++/23437 * g++.dg/template/arg4.C: New test. diff --git a/gcc/testsuite/g++.dg/warn/Wunused-12.C b/gcc/testsuite/g++.dg/warn/Wunused-12.C new file mode 100644 index 00000000000..51d23433153 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wunused-12.C @@ -0,0 +1,8 @@ +// PR c++/24302 +// { dg-options "-Wunused" } + +static union +{ + unsigned char FLT4ARR[4]; + float FLT4; +}; // { dg-warning "used" } diff --git a/gcc/toplev.c b/gcc/toplev.c index 796c7bf87e5..eea9ab20ead 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -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. */