From ffef8182945d99fe9a00dd7e6f4f32b4c5d8bb46 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Mon, 27 Aug 2007 18:04:37 -0400 Subject: [PATCH] re PR c++/31337 (ICE with statement expression) PR c++/31337 * gimplify.c (gimplify_modify_expr): Discard the assignment of zero-sized types after calling gimplify_modify_expr_rhs. From-SVN: r127840 --- gcc/ChangeLog | 6 ++++++ gcc/gimplify.c | 18 ++++++++++-------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index eeb3d6d7bbac..0a5af766e0d8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2007-08-27 Jason Merrill + + PR c++/31337 + * gimplify.c (gimplify_modify_expr): Discard the assignment of + zero-sized types after calling gimplify_modify_expr_rhs. + 2007-08-24 Jakub Jelinek PR debug/32610 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e6c0d1f241db..80dcd1ac5f2a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3532,8 +3532,16 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR || TREE_CODE (*expr_p) == INIT_EXPR); - /* For zero sized types only gimplify the left hand side and right hand side - as statements and throw away the assignment. */ + /* See if any simplifications can be done based on what the RHS is. */ + ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p, + want_value); + if (ret != GS_UNHANDLED) + return ret; + + /* For zero sized types only gimplify the left hand side and right hand + side as statements and throw away the assignment. Do this after + gimplify_modify_expr_rhs so we handle TARGET_EXPRs of addressable + types properly. */ if (zero_sized_type (TREE_TYPE (*from_p))) { gimplify_stmt (from_p); @@ -3544,12 +3552,6 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) return GS_ALL_DONE; } - /* See if any simplifications can be done based on what the RHS is. */ - ret = gimplify_modify_expr_rhs (expr_p, from_p, to_p, pre_p, post_p, - want_value); - if (ret != GS_UNHANDLED) - return ret; - /* If the value being copied is of variable width, compute the length of the copy into a WITH_SIZE_EXPR. Note that we need to do this before gimplifying any of the operands so that we can resolve any -- 2.47.2