summaryrefslogtreecommitdiff
path: root/gcc/gimplify.c
diff options
context:
space:
mode:
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-27 20:02:22 +0000
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-27 20:02:22 +0000
commitcf39ec50a992c196a37ba5486ce6412096e867d0 (patch)
tree0beec1120900beb0a9e1598d152f7637242092b1 /gcc/gimplify.c
parent5fa64d45dcd4a9d625145d61aa1f92344de2bbdf (diff)
downloadgcc-cf39ec50a992c196a37ba5486ce6412096e867d0.tar.gz
PR c++/31337
* gimplify.c (gimplify_modify_expr): Discard the assignment of zero-sized types after calling gimplify_modify_expr_rhs. * testsuite/g++.dg/ext/stmtexpr11.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127838 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r--gcc/gimplify.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index cea79919965..aed8ab76949 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -3654,8 +3654,16 @@ gimplify_modify_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value)
|| TREE_CODE (*expr_p) == GIMPLE_MODIFY_STMT
|| 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);
@@ -3666,12 +3674,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