[PATCH] PR c++/17554, ice in create_tmp_var, cleanup_expr
Andrew Pinski
pinskia@physics.uc.edu
Tue Oct 5 14:54:00 GMT 2004
On Oct 5, 2004, at 12:19 AM, Andrew Pinski wrote:
> 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.
Here is a patch which is safer and only changes the type to void if
the type was an aggregate before.
OK? Bootstrapped and tested on powerpc-darwin with no regressions
Thanks,
Andrew Pinski
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 if we have an aggregate
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 14:44:23 -0000
@@ -358,7 +358,12 @@ 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);
+ {
+ tree type = TREE_TYPE (expr);
+ if (AGGREGATE_TYPE_P (type))
+ type = void_type_node;
+ expr = build1 (CLEANUP_POINT_EXPR, type, fold (expr));
+ }
return expr;
}
More information about the Gcc-patches
mailing list