This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
3.1 C++ PATCH to fix c++/5504, re-break c++/411 (was Re: GCC 3.1Prerelease)
- From: Jason Merrill <jason at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: Richard Henderson <rth at redhat dot com>,Peter Schmid <schmid at snake dot iap dot physik dot tu-darmstadt dot de>,gcc-patches at gcc dot gnu dot org
- Date: Tue, 23 Apr 2002 22:49:50 +0100
- Subject: 3.1 C++ PATCH to fix c++/5504, re-break c++/411 (was Re: GCC 3.1Prerelease)
- References: <Pine.LNX.4.30.0204210235010.13395-100000@snake.iap.physik.tu-da<Pine.LNX.4.30.0204210235010.13395-100000@snake.iap.physik.tu-darmstadt.de><3340000.1019348655@gandalf.codesourcery.com><20020421135047.A31524@redhat.com><12250000.1019426436@gandalf.codesourcery.com><wvlelh68u1c.fsf@prospero.cambridge.redhat.com><19890000.1019577872@gandalf.codesourcery.com>
>>>>> "Mark" == Mark Mitchell <mark@codesourcery.com> writes:
> --On Tuesday, April 23, 2002 01:43:27 PM +0100 Jason Merrill
> <jason@redhat.com> wrote:
>>>>>>> "Mark" == Mark Mitchell <mark@codesourcery.com> writes:
>>
>>> I'm inclined just to suffer here, but let's see what Jason thinks.
>>
>> I think I'm inclined to restore the bug on the branch.
> That makes some sense.
> OK, let's respect your decision. Would you please undo your change?
The patch below undoes the effect without reverting the associated
cleanup.
> I guess we should keep the PR open -- and high priority -- since keeping
> the change on the mainline means we already have a known performance
> regression to GCC 3.2.
Yep.
Tested i686-pc-linux-gnu, applied to 3.1 branch only.
2002-04-23 Jason Merrill <jason@redhat.com>
PR c++/5504 - but re-breaks c++/411
* init.c (push_base_cleanups): Rename to perform_base_cleanups.
Expand base cleanups now rather than pushing them.
* decl.c (begin_destructor_body): Don't call push_base_cleanups.
(finish_destructor_body): Call perform_base_cleanups.
* cp-tree.h: Adjust prototype.
*** cp-tree.h.~1~ Thu Apr 18 14:22:25 2002
--- cp-tree.h Tue Apr 23 21:39:24 2002
*************** extern tree build_new PARAMS ((tree,
*** 3907,3913 ****
extern tree build_vec_init PARAMS ((tree, tree, int));
extern tree build_x_delete PARAMS ((tree, int, tree));
extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int));
! extern void push_base_cleanups PARAMS ((void));
extern tree build_vbase_delete PARAMS ((tree, tree));
extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int));
extern tree create_temporary_var PARAMS ((tree));
--- 3907,3913 ----
extern tree build_vec_init PARAMS ((tree, tree, int));
extern tree build_x_delete PARAMS ((tree, int, tree));
extern tree build_delete PARAMS ((tree, tree, special_function_kind, int, int));
! extern void perform_base_cleanups PARAMS ((void));
extern tree build_vbase_delete PARAMS ((tree, tree));
extern tree build_vec_delete PARAMS ((tree, tree, special_function_kind, int));
extern tree create_temporary_var PARAMS ((tree));
*** decl.c.~1~ Thu Apr 18 14:45:24 2002
--- decl.c Tue Apr 23 21:39:24 2002
*************** begin_destructor_body ()
*** 14074,14083 ****
finish_compound_stmt (/*has_no_scope=*/0, compound_stmt);
finish_then_clause (if_stmt);
finish_if_stmt ();
-
- /* And insert cleanups for our bases and members so that they
- will be properly destroyed if we throw. */
- push_base_cleanups ();
}
/* At the end of every destructor we generate code to delete the object if
--- 14074,14079 ----
*************** finish_destructor_body ()
*** 14088,14093 ****
--- 14084,14092 ----
{
tree exprstmt;
+ /* And perform cleanups for our bases and members. */
+ perform_base_cleanups ();
+
/* In a virtual destructor, we must call delete. */
if (DECL_VIRTUAL_P (current_function_decl))
{
*** init.c.~1~ Thu Apr 18 14:45:24 2002
--- init.c Tue Apr 23 21:39:24 2002
*************** build_delete (type, addr, auto_delete, f
*** 3217,3229 ****
}
}
! /* At the beginning of a destructor, push cleanups that will call the
! destructors for our base classes and members.
! Called from setup_vtbl_ptr. */
void
! push_base_cleanups ()
{
tree binfos;
int i, n_baseclasses;
--- 3217,3229 ----
}
}
! /* At the end of a destructor, call the destructors for our base classes
! and members.
! Called from finish_destructor_body. */
void
! perform_base_cleanups ()
{
tree binfos;
int i, n_baseclasses;
*************** push_base_cleanups ()
*** 3267,3273 ****
LOOKUP_NORMAL);
expr = build (COND_EXPR, void_type_node, cond,
expr, void_zero_node);
! finish_decl_cleanup (NULL_TREE, expr);
}
}
}
--- 3267,3273 ----
LOOKUP_NORMAL);
expr = build (COND_EXPR, void_type_node, cond,
expr, void_zero_node);
! finish_expr_stmt (expr);
}
}
}
*************** push_base_cleanups ()
*** 3287,3293 ****
base_dtor_identifier,
NULL_TREE);
! finish_decl_cleanup (NULL_TREE, expr);
}
for (member = TYPE_FIELDS (current_class_type); member;
--- 3287,3293 ----
base_dtor_identifier,
NULL_TREE);
! finish_expr_stmt (expr);
}
for (member = TYPE_FIELDS (current_class_type); member;
*************** push_base_cleanups ()
*** 3305,3311 ****
sfk_complete_destructor,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL,
0);
! finish_decl_cleanup (NULL_TREE, expr);
}
}
}
--- 3305,3311 ----
sfk_complete_destructor,
LOOKUP_NONVIRTUAL|LOOKUP_DESTRUCTOR|LOOKUP_NORMAL,
0);
! finish_expr_stmt (expr);
}
}
}