diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-02 06:11:49 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-10-02 06:11:49 +0000 |
commit | 0aa655a06f31f6674b8a84127c45a8593ff9aaaa (patch) | |
tree | 4e87301cda3476dbc9491d3c3b3aab872e6e68e1 /gcc/gimplify.c | |
parent | 6b5d7622ee716d757317c98bf01b8f1f966e7f12 (diff) | |
download | gcc-0aa655a06f31f6674b8a84127c45a8593ff9aaaa.tar.gz |
PR c/29154
* gimplify.c (gimplify_self_mod_expr): Run inner expression's post
side effects after the outer expression's post side effects.
* gcc.c-torture/execute/20060929-1.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@117366 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9db673a62d9..84c7219ce03 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1896,7 +1896,7 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p, bool want_value) { enum tree_code code; - tree lhs, lvalue, rhs, t1; + tree lhs, lvalue, rhs, t1, post = NULL, *orig_post_p = post_p; bool postfix; enum tree_code arith_code; enum gimplify_status ret; @@ -1913,6 +1913,11 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p, else postfix = false; + /* For postfix, make sure the inner expression's post side effects + are executed after side effects from this expression. */ + if (postfix) + post_p = &post; + /* Add or subtract? */ if (code == PREINCREMENT_EXPR || code == POSTINCREMENT_EXPR) arith_code = PLUS_EXPR; @@ -1943,7 +1948,8 @@ gimplify_self_mod_expr (tree *expr_p, tree *pre_p, tree *post_p, if (postfix) { - gimplify_and_add (t1, post_p); + gimplify_and_add (t1, orig_post_p); + append_to_statement_list (post, orig_post_p); *expr_p = lhs; return GS_ALL_DONE; } |