This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFC] PR c++/17554, ice in create_tmp_var, cleanup_expr
- From: Andrew Pinski <pinskia at physics dot uc dot edu>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 5 Oct 2004 00:19:24 -0400
- Subject: [RFC] PR c++/17554, ice in create_tmp_var, cleanup_expr
I don't know if this is the right fix but it works for this testcase.
But should the cleanup point expression have the same type as what is
containing it or not? If have it set to the same as the expression
which contains, we ICE in create_tmp_var as we are creating a temporary
variable for struct which we cannot do.
Thanks,
Andrew Pinski
I have not tested or bootstrapped this patch yet but I want to know
if this is a correct fix or even the correct approach.
Testcase:
struct A { int i; A(); A(const A&); };
void bar()
{
A a;
for ( ;; a=A() ) ;
}
ChangeLog:
* semantics.c (maybe_cleanup_point_expr): Set the type of the
cleanup point expression to void type.
Index: semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.441
diff -u -p -r1.441 semantics.c
--- semantics.c 1 Oct 2004 15:11:21 -0000 1.441
+++ semantics.c 5 Oct 2004 04:13:43 -0000
@@ -358,7 +358,7 @@ static tree
maybe_cleanup_point_expr (tree expr)
{
if (!processing_template_decl && stmts_are_full_exprs_p ())
- expr = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr);
+ expr = build1 (CLEANUP_POINT_EXPR, void_type_node, fold (expr));
return expr;
}