aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@markmitchell.com>1998-11-22 17:50:33 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1998-11-22 17:50:33 +0000
commit536333d40b7c5a62216bcccaf1c41f71f28c84e6 (patch)
tree1cc39d308e45d70f85d0739fca97d3f92d0d1e40 /gcc
parentff0236af5a568d756186f42f595147ce674f48d5 (diff)
downloadgcc-536333d40b7c5a62216bcccaf1c41f71f28c84e6.zip
gcc-536333d40b7c5a62216bcccaf1c41f71f28c84e6.tar.gz
gcc-536333d40b7c5a62216bcccaf1c41f71f28c84e6.tar.bz2
decl.c (poplevel): Remove code to handle KEEP == 2.
* decl.c (poplevel): Remove code to handle KEEP == 2. (finish_function): Don't confuse BLOCK-order when processing a destructor. From-SVN: r23755
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/decl.c23
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/debug2.C31
3 files changed, 45 insertions, 15 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 2345a06..15b37aa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+1998-11-22 Mark Mitchell <mark@markmitchell.com>
+
+ * decl.c (poplevel): Remove code to handle KEEP == 2.
+ (finish_function): Don't confuse BLOCK-order when
+ processing a destructor.
+
1998-11-21 Jason Merrill <jason@yorick.cygnus.com>
* decl.c (require_complete_types_for_parms): Call layout_decl
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 0d95092..d50c5ea 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1043,12 +1043,6 @@ pushlevel_temporary (tag_transparent)
and create a "block" (a BLOCK node) for the level
to record its declarations and subblocks for symbol table output.
- If KEEP == 2, this level's subblocks go to the front,
- not the back of the current binding level. This happens,
- for instance, when code for constructors and destructors
- need to generate code at the end of a function which must
- be moved up to the front of the function.
-
If FUNCTIONBODY is nonzero, this level is the body of a function,
so create a block as if KEEP were set and also clear out all
label names.
@@ -1075,6 +1069,11 @@ poplevel (keep, reverse, functionbody)
tree decl;
int block_previously_created;
+ /* We used to use KEEP == 2 to indicate that the new block should go
+ at the beginning of the list of blocks at this binding level,
+ rather than the end. This hack is no longer used. */
+ my_friendly_assert (keep == 0 || keep == 1, 0);
+
GNU_xref_end_scope ((HOST_WIDE_INT) current_binding_level,
(HOST_WIDE_INT) current_binding_level->level_chain,
current_binding_level->parm_flag,
@@ -1325,14 +1324,8 @@ poplevel (keep, reverse, functionbody)
must be carried forward so they will later become subblocks
of something else. */
else if (subblocks)
- {
- if (keep == 2)
- current_binding_level->blocks
- = chainon (subblocks, current_binding_level->blocks);
- else
- current_binding_level->blocks
- = chainon (current_binding_level->blocks, subblocks);
- }
+ current_binding_level->blocks
+ = chainon (current_binding_level->blocks, subblocks);
/* Take care of compiler's internal binding structures. */
if (tmp == 2)
@@ -13302,7 +13295,7 @@ finish_function (lineno, call_poplevel, nested)
/* End of destructor. */
expand_end_bindings (NULL_TREE, getdecls () != NULL_TREE, 0);
- poplevel (2, 0, 0); /* XXX change to 1 */
+ poplevel (getdecls () != NULL_TREE, 0, 0);
/* Back to the top of destructor. */
/* Don't execute destructor code if `this' is NULL. */
diff --git a/gcc/testsuite/g++.old-deja/g++.other/debug2.C b/gcc/testsuite/g++.old-deja/g++.other/debug2.C
new file mode 100644
index 0000000..200aeb3
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/debug2.C
@@ -0,0 +1,31 @@
+// Build don't link:
+// Special g++ Options: -funroll-loops -O2 -g
+
+inline void f()
+{
+ typedef int T;
+}
+
+inline void g()
+{
+ typedef double U;
+}
+
+int n;
+
+struct B
+{
+ ~B() {
+ for (int i = 0; i < n; ++i)
+ g();
+ }
+};
+
+struct D : public B {
+ ~D() {
+ for (int j = 0; j < n; ++j)
+ f();
+ }
+};
+
+D d;