decl.c (pushdecl): Don't copy types if the DECL_ABSTRACT_ORIGIN of the new decl match...
authorMark Mitchell <mark@markmitchell.com>
Thu, 10 Sep 1998 11:20:43 +0000 (11:20 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 10 Sep 1998 11:20:43 +0000 (11:20 +0000)
* decl.c (pushdecl): Don't copy types if the
DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
type.

From-SVN: r22381

gcc/cp/ChangeLog
gcc/cp/decl.c
gcc/testsuite/g++.old-deja/g++.other/crash3.C [new file with mode: 0644]

index 01b8371c5ccac40d435977a4e5d2235bdc800744..5c3d2a77ba6b66870fa46ef6953adb08ca540c6a 100644 (file)
@@ -1,3 +1,9 @@
+1998-09-10  Mark Mitchell  <mark@markmitchell.com>
+
+       * decl.c (pushdecl): Don't copy types if the
+       DECL_ABSTRACT_ORIGIN of the new decl matches the TYPE_NAME of the
+       type. 
+
 1998-09-09  Kriang Lerdsuwanakij <lerdsuwa@scf-fs.usc.edu>
 
        * class.c (get_enclosing_class): New function.
index 1714e828aea622cefb97282bf2dccf5b88572671..98f933607b7daf7d3651779a683262d4c2254648 100644 (file)
@@ -3479,7 +3479,12 @@ pushdecl (x)
              if (TYPE_NAME (type) == 0)
                TYPE_NAME (type) = x;
             }
-          else if (type != error_mark_node && TYPE_NAME (type) != x)
+          else if (type != error_mark_node && TYPE_NAME (type) != x
+                  /* We don't want to copy the type when all we're
+                     doing is making a TYPE_DECL for the purposes of
+                     inlining.  */
+                  && (!TYPE_NAME (type) 
+                      || TYPE_NAME (type) != DECL_ABSTRACT_ORIGIN (x)))
             {
              push_obstacks (TYPE_OBSTACK (type), TYPE_OBSTACK (type));
 
diff --git a/gcc/testsuite/g++.old-deja/g++.other/crash3.C b/gcc/testsuite/g++.old-deja/g++.other/crash3.C
new file mode 100644 (file)
index 0000000..0114843
--- /dev/null
@@ -0,0 +1,14 @@
+// Build don't link:
+// Special g++ Options: -g -O2
+
+inline void f() {
+  struct S {};
+  S s;
+}
+
+int g()
+{
+  for (int i = 0; i < 2; ++i)
+    f();
+}
+