]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/6073 ([Solaris] Internal compiler error in simplify_gen_subreg, at simplify...
authorJakub Jelinek <jakub@redhat.com>
Fri, 29 Mar 2002 07:47:06 +0000 (08:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 29 Mar 2002 07:47:06 +0000 (08:47 +0100)
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
gcc/cp/class.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/static1.C [new file with mode: 0644]

index 5a936bae11f34fa57e1be50b3b96b25cc0c4ea61..20faafd46b62df077fd99fb8a306b54561534e55 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-29  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <neil@daikokuya.demon.co.uk>
 
        * cp-lang.c (LANG_HOOKS_INSERT_DEFAULT_ATTRIBUTES): Redefine.
index cd23a0e31751a19a77ffb6d01281777af8cecb75..1bba932455cd52552547bd673b0ea2d4aae67744 100644 (file)
@@ -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
index 950a5fe0ab0397a27e4da646b974f3a6a67a55e1..7f68789c12224b0665d6af665af8ce55ab0fff6e 100644 (file)
@@ -1,3 +1,7 @@
+2002-03-29  Jakub Jelinek  <jakub@redhat.com>
+
+       * g++.dg/opt/static1.C: New test.
+
 2002-03-28  Hans-Peter Nilsson  <hp@bitrange.com>
 
        * 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 (file)
index 0000000..05429e1
--- /dev/null
@@ -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);
+}