From 1c80fb65ce6ad63e8499e9c5cfd1ace348d831df Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 10 Sep 1998 11:20:43 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/decl.c | 7 ++++++- gcc/testsuite/g++.old-deja/g++.other/crash3.C | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/crash3.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 01b8371c5cc..5c3d2a77ba6 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +1998-09-10 Mark Mitchell + + * 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 * class.c (get_enclosing_class): New function. diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 1714e828aea..98f933607b7 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 00000000000..01148434535 --- /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(); +} + -- 2.30.2