aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-09-10 11:20:43 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-09-10 11:20:43 +0000
commit1c80fb65ce6ad63e8499e9c5cfd1ace348d831df (patch)
tree40c2065d805fdb2bc7a4864ebb0e31fafc2f7c52 /gcc
parent02e24c7ab0cc632fefb621ae3dbce2a2a05dbc3c (diff)
downloadgcc-1c80fb65ce6ad63e8499e9c5cfd1ace348d831df.zip
gcc-1c80fb65ce6ad63e8499e9c5cfd1ace348d831df.tar.gz
gcc-1c80fb65ce6ad63e8499e9c5cfd1ace348d831df.tar.bz2
decl.c (pushdecl): Don't copy types if the DECL_ABSTRACT_ORIGIN of the new decl matches the...
* 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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c7
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/crash3.C14
3 files changed, 26 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 01b8371..5c3d2a7 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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.
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 1714e82..98f9336 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -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
index 0000000..0114843
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/crash3.C
@@ -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();
+}
+