This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] PR c++/17554, ice in create_tmp_var, cleanup_expr

On Oct 6, 2004, at 4:23 PM, Jason Merrill wrote:

On Tue, 5 Oct 2004 10:45:42 -0400, Andrew Pinski <> wrote:

Here is a patch which is safer and only changes the type to void if
the type was an aggregate before.

I actually like your first patch better. If it were problematic, this patch would not be a solution.

The first patch had a problem because we used maybe_cleanup_point_expr in a place where we needed the type set to the same as expression. The place comes from switch statements. I added another function which is the old maybe_cleanup_point_expr.

OK? Bootstrapped and tested on powerpc-darwin with no regressions.

Andrew Pinski


	* semantics.c (maybe_cleanup_point_expr): Set the type of the
	cleanup point expression to void type.
	(maybe_cleanup_point_expr_non_void): New function.
	(finish_switch_cond): Use maybe_cleanup_point_expr_non_void.

Index: semantics.c
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.442
diff -u -p -r1.442 semantics.c
--- semantics.c 6 Oct 2004 22:09:22 -0000 1.442
+++ semantics.c 6 Oct 2004 22:59:01 -0000
@@ -358,6 +358,17 @@ static tree
maybe_cleanup_point_expr (tree expr)
if (!processing_template_decl && stmts_are_full_exprs_p ())
+ expr = build1 (CLEANUP_POINT_EXPR, void_type_node, expr);
+ return expr;
+/* Like maybe_cleanup_point_expr except we use the type of the expression instead
+ of void type. */
+static tree
+maybe_cleanup_point_expr_non_void (tree expr)
+ if (!processing_template_decl && stmts_are_full_exprs_p ())
expr = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr);
return expr;
@@ -863,7 +874,7 @@ finish_switch_cond (tree cond, tree swit

 	     Integral promotions are performed.  */
 	  cond = perform_integral_promotions (cond);
-	  cond = maybe_cleanup_point_expr (cond);
+	  cond = maybe_cleanup_point_expr_non_void (cond);

if (cond != error_mark_node)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]