From c7f4981a5122c9b1dfcbe4596b05515d055a4b17 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 29 Mar 2002 08:47:06 +0100 Subject: [PATCH] re PR c++/6073 ([Solaris] Internal compiler error in simplify_gen_subreg, at simplify-rtx.c:2711) PR c++/6073 * class.c (finish_struct_1): Update static field's DECL_MODE even if its type is a variant of t. * g++.dg/opt/static1.C: New test. From-SVN: r51549 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/class.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/opt/static1.C | 20 ++++++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/opt/static1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 5a936bae11f..20faafd46b6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2002-03-29 Jakub Jelinek + + PR c++/6073 + * class.c (finish_struct_1): Update static field's DECL_MODE even + if its type is a variant of t. + 2002-03-27 Neil Booth * cp-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Redefine. diff --git a/gcc/cp/class.c b/gcc/cp/class.c index cd23a0e3175..1bba932455c 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5191,7 +5191,7 @@ finish_struct_1 (t) working on. */ for (x = TYPE_FIELDS (t); x; x = TREE_CHAIN (x)) if (TREE_CODE (x) == VAR_DECL && TREE_STATIC (x) - && TREE_TYPE (x) == t) + && same_type_p (TYPE_MAIN_VARIANT (TREE_TYPE (x)), t)) DECL_MODE (x) = TYPE_MODE (t); /* Done with FIELDS...now decide whether to sort these for diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 950a5fe0ab0..7f68789c122 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-03-29 Jakub Jelinek + + * g++.dg/opt/static1.C: New test. + 2002-03-28 Hans-Peter Nilsson * gcc.dg/weak-1.c: Fix typo in scan-assembler pattern. diff --git a/gcc/testsuite/g++.dg/opt/static1.C b/gcc/testsuite/g++.dg/opt/static1.C new file mode 100644 index 00000000000..05429e18bb5 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/static1.C @@ -0,0 +1,20 @@ +// PR c++/6073 +// This testcase ICEd because finish_struct_bits changed +// A's and const A's TYPE_MODE from QI to BLK, but did +// not change a's DECL_MODE because its mode was not +// TYPE_MAIN_VARIANT. + +struct A +{ + static const A a; + ~A (); +}; + +void bar (A x); +void foo (); + +void +foo () +{ + bar (A::a); +}