diff options
author | Richard Guenther <rguenther@suse.de> | 2012-03-16 11:48:48 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-03-16 11:48:48 +0000 |
commit | cf1867a027259b46b63abed5f6e34b479d52f186 (patch) | |
tree | fd6164df3d13458148ba996bd6207adb2d05f5df /gcc/gimplify.c | |
parent | 2447776cc92a53f18c9a439e198cfd1d8f9cb330 (diff) | |
download | gcc-cf1867a027259b46b63abed5f6e34b479d52f186.zip gcc-cf1867a027259b46b63abed5f6e34b479d52f186.tar.gz gcc-cf1867a027259b46b63abed5f6e34b479d52f186.tar.bz2 |
re PR middle-end/48814 (Incorrect scalar increment result)
2012-03-16 Richard Guenther <rguenther@suse.de>
Kai Tietz <ktietz@redhat.com>
PR middle-end/48814
* gimplify.c (gimplify_self_mod_expr): Evaluate postfix
side-effects completely in the pre-queue and use a temporary
for the result.
* gcc.c-torture/execute/pr48814-1.c: New test.
* gcc.c-torture/execute/pr48814-2.c: New test.
* gcc.dg/tree-ssa/assign-1.c: New test.
* gcc.dg/tree-ssa/assign-2.c: New test.
* gcc.dg/tree-ssa/assign-3.c: New test.
Co-Authored-By: Kai Tietz <ktietz@redhat.com>
From-SVN: r185465
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 07eb8fd..3c41294 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2265,17 +2265,18 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, arith_code = POINTER_PLUS_EXPR; } - t1 = build2 (arith_code, TREE_TYPE (*expr_p), lhs, rhs); - if (postfix) { - gimplify_assign (lvalue, t1, orig_post_p); + tree t2 = get_initialized_tmp_var (lhs, pre_p, NULL); + t1 = build2 (arith_code, TREE_TYPE (*expr_p), t2, rhs); + gimplify_assign (lvalue, t1, pre_p); gimplify_seq_add_seq (orig_post_p, post); - *expr_p = lhs; + *expr_p = t2; return GS_ALL_DONE; } else { + t1 = build2 (arith_code, TREE_TYPE (*expr_p), lhs, rhs); *expr_p = build2 (MODIFY_EXPR, TREE_TYPE (lvalue), lvalue, t1); return GS_OK; } |