aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-15 04:36:04 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2000-01-15 04:36:04 +0000
commit60dcc3dc58af523c9c3005e2e64ed3c7213245bc (patch)
tree069df75f42aabb66d6b6154be932e6e175dff18d
parentec7d7ef93e737797dc0746272553b5d2db933a44 (diff)
* optimize.c (copy_body_r): Clear the operand three of a
TARGET_EXPR when copying it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@31435 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/optimize.c10
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/inline5.C30
3 files changed, 43 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 619d94c5c83..372f618a46a 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2000-01-14 Mark Mitchell <mark@codesourcery.com>
+
+ * optimize.c (copy_body_r): Clear the operand three of a
+ TARGET_EXPR when copying it.
+
2000-01-14 Martin v. Löwis <loewis@informatik.hu-berlin.de>
* method.c (build_decl_overload_real): Check whether we are in ::
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 2dd151ccb01..f529e9d70a6 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -1,6 +1,6 @@
/* Perform optimizations on tree structure.
- Copyright (C) 1998, 1999 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
Written by Mark Michell (mark@codesourcery.com).
This file is part of GNU CC.
@@ -285,6 +285,9 @@ copy_body_r (tp, walk_subtrees, data)
/* Replace this variable with the copy. */
*tp = new_decl;
}
+ else if (nonstatic_local_decl_p (*tp)
+ && DECL_CONTEXT (*tp) != VARRAY_TREE (id->fns, 0))
+ my_friendly_abort (0);
else if (TREE_CODE (*tp) == SAVE_EXPR)
remap_save_expr (tp, id->decl_map, VARRAY_TREE (id->fns, 0),
walk_subtrees);
@@ -303,7 +306,10 @@ copy_body_r (tp, walk_subtrees, data)
/* The copied TARGET_EXPR has never been expanded, even if the
original node was expanded already. */
if (TREE_CODE (*tp) == TARGET_EXPR && TREE_OPERAND (*tp, 3))
- TREE_OPERAND (*tp, 1) = TREE_OPERAND (*tp, 3);
+ {
+ TREE_OPERAND (*tp, 1) = TREE_OPERAND (*tp, 3);
+ TREE_OPERAND (*tp, 3) = NULL_TREE;
+ }
/* Similarly, if we're copying a CALL_EXPR, the RTL for the
result is no longer valid. */
else if (TREE_CODE (*tp) == CALL_EXPR)
diff --git a/gcc/testsuite/g++.old-deja/g++.other/inline5.C b/gcc/testsuite/g++.old-deja/g++.other/inline5.C
new file mode 100644
index 00000000000..305fd0ac608
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/inline5.C
@@ -0,0 +1,30 @@
+// Build don't link:
+// Origin: Matt Austern <austern@isolde.engr.sgi.com>
+// Special g++ Options: -O2
+
+class X;
+
+extern X* tab1;
+
+struct Y {
+ explicit Y(int);
+};
+
+void* x ();
+
+Y k (void *);
+
+inline void f() { k (x ()); }
+
+inline void* x ()
+{
+ return 0;
+}
+
+static void g() {
+ f();
+}
+
+static void h() {
+ f();
+}