From e1dfe00531385492850be7b5d8f2aa32b3b32f1c Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Wed, 7 Nov 2012 11:15:40 +0000 Subject: [PATCH] re PR c++/55226 (ICE regression in regard to anonymous unions and constexpr) /cp 2012-11-07 Paolo Carlini PR c++/55226 Revert: 2012-10-23 Paolo Carlini PR c++/54922 * semantics.c (cx_check_missing_mem_inits): Handle anonymous union members. /testsuite 2012-11-07 Paolo Carlini PR c++/55226 Revert: 2012-10-23 Paolo Carlini PR c++/54922 * g++.dg/cpp0x/constexpr-union4.C: New. From-SVN: r193292 --- gcc/cp/ChangeLog | 12 +++++++++++- gcc/cp/semantics.c | 12 +++--------- gcc/testsuite/ChangeLog | 15 +++++++++++++-- gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C | 13 ------------- 4 files changed, 27 insertions(+), 25 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c623b5e..339a835 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,13 @@ +2012-11-07 Paolo Carlini + + PR c++/55226 + Revert: + 2012-10-23 Paolo Carlini + + PR c++/54922 + * semantics.c (cx_check_missing_mem_inits): Handle anonymous union + members. + 2012-11-07 Florian Weimer * init.c (build_new_1): Do not check for arithmetic overflow if @@ -12,7 +22,7 @@ * decl.c (decls_match): Make decls unmatched for versioned functions. (duplicate_decls): Remove ambiguity for versioned functions. - Delete versioned function data for merged decls. + Delete versioned function data for merged decls. * decl2.c (check_classfn): Check attributes of versioned functions for match. * call.c (get_function_version_dispatcher): New function. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 073ee97..7def254 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -6139,23 +6139,17 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain) for (i = 0; i <= nelts; ++i) { tree index; - tree anon_union_init_type = NULL_TREE; if (i == nelts) index = NULL_TREE; else { index = CONSTRUCTOR_ELT (body, i)->index; - /* Handle anonymous union members. */ - if (TREE_CODE (index) == COMPONENT_REF - && ANON_UNION_TYPE_P (TREE_TYPE (TREE_OPERAND (index, 0)))) - anon_union_init_type = TREE_TYPE (TREE_OPERAND (index, 0)); /* Skip base and vtable inits. */ - else if (TREE_CODE (index) != FIELD_DECL - || DECL_ARTIFICIAL (index)) + if (TREE_CODE (index) != FIELD_DECL + || DECL_ARTIFICIAL (index)) continue; } - for (; field != index && TREE_TYPE (field) != anon_union_init_type; - field = DECL_CHAIN (field)) + for (; field != index; field = DECL_CHAIN (field)) { tree ftype; if (TREE_CODE (field) != FIELD_DECL diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 23f142a..9b21b4c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2012-11-07 Paolo Carlini + + PR c++/55226 + Revert: + 2012-10-23 Paolo Carlini + + PR c++/54922 + * g++.dg/cpp0x/constexpr-union4.C: New. + 2012-11-07 Yufeng Zhang * gcc.target/aarch64/dwarf-cfa-reg.c: New test. @@ -17,7 +26,8 @@ 2012-11-06 Andrew Pinski - * gcc.target/aarch64/vect-fmaxv-fminv-compile.c: Add -fno-vect-cost-model. + * gcc.target/aarch64/vect-fmaxv-fminv-compile.c: Add + -fno-vect-cost-model. 2012-11-06 Aldy Hernandez @@ -37,7 +47,8 @@ 2012-11-06 Jan Hubicka - * gcc.dg/tree-ssa/loop-1.c: Make to look like a good unroling candidate still. + * gcc.dg/tree-ssa/loop-1.c: Make to look like a good unroling + candidate still. * gcc.dg/tree-ssa/loop-23.c: Likewise. * gcc.dg/tree-ssa/cunroll-1.c: Unrolling now happens early. * gcc.dg/tree-prof/unroll-1.c: Remove confused dg-options. diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C deleted file mode 100644 index 5695cb2..0000000 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-union4.C +++ /dev/null @@ -1,13 +0,0 @@ -// PR c++/54922 -// { dg-do compile { target c++11 } } - -class nullable_int -{ - bool init_; - union { - unsigned char for_value_init; - int value_; - }; -public: - constexpr nullable_int() : init_(false), for_value_init() {} -}; -- 2.7.4