aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-05-19 03:54:49 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-05-19 03:54:49 +0000
commit1483bddbc8ac81700a3ccd699a6ca6587d9a9712 (patch)
tree64ec22c9f840b99c27e5cc204fe99be474223e56
parent5458582593fe80311b1589fa2a1d3eca4cee39a6 (diff)
downloadgcc-1483bddbc8ac81700a3ccd699a6ca6587d9a9712.zip
gcc-1483bddbc8ac81700a3ccd699a6ca6587d9a9712.tar.gz
gcc-1483bddbc8ac81700a3ccd699a6ca6587d9a9712.tar.bz2
stmt.c (expand_return): Call start_cleanup_deferral and end_cleanup_deferral around conditional code.
* stmt.c (expand_return): Call start_cleanup_deferral and end_cleanup_deferral around conditional code. From-SVN: r27018
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/stmt.c2
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/cleanup2.C26
3 files changed, 33 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 28a516f..860338c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+Wed May 19 03:56:56 1999 Mark Mitchell <mark@codesourcery.com>
+
+ * stmt.c (expand_return): Call start_cleanup_deferral and
+ end_cleanup_deferral around conditional code.
+
Wed May 19 03:10:08 1999 Bruce Korb <ddsinc09@ix.netcom.com>
* fixinc/fixincl.tpl: Avoid depending on ANSI C features for
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 41bc736..9c8a716 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -2703,6 +2703,7 @@ expand_return (retval)
tree expr;
do_jump (TREE_OPERAND (retval_rhs, 0), label, NULL_RTX);
+ start_cleanup_deferral ();
expr = build (MODIFY_EXPR, TREE_TYPE (TREE_TYPE (current_function_decl)),
DECL_RESULT (current_function_decl),
TREE_OPERAND (retval_rhs, 1));
@@ -2715,6 +2716,7 @@ expand_return (retval)
TREE_OPERAND (retval_rhs, 2));
TREE_SIDE_EFFECTS (expr) = 1;
expand_return (expr);
+ end_cleanup_deferral ();
return;
}
diff --git a/gcc/testsuite/g++.old-deja/g++.other/cleanup2.C b/gcc/testsuite/g++.old-deja/g++.other/cleanup2.C
new file mode 100644
index 0000000..4cd0b55
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/cleanup2.C
@@ -0,0 +1,26 @@
+// Origin: Bryan Scattergood <bryan@fsel.com>
+// Special g++ Options: -O -fno-exceptions
+
+extern "C" void abort();
+
+class A
+{
+public:
+ A();
+ ~A();
+ int foo();
+};
+
+A::A() {}
+A::~A() { abort (); }
+int A::foo() {}
+
+extern int f()
+{
+ return 0;
+}
+
+int main()
+{
+ return ((f() != 0) ? A().foo() : 0);
+}