aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Wilson <wilson@gcc.gnu.org>1993-08-08 15:48:15 -0700
committerJim Wilson <wilson@gcc.gnu.org>1993-08-08 15:48:15 -0700
commit591b15bb1c185e2364e4e2ed65d1bebb48fbfb2b (patch)
tree27ba05898fc3296b668be3e7212815b2f2be54e9
parent3de13334ba84c74f6c7cb0c0e6524d74d32734aa (diff)
downloadgcc-591b15bb1c185e2364e4e2ed65d1bebb48fbfb2b.zip
gcc-591b15bb1c185e2364e4e2ed65d1bebb48fbfb2b.tar.gz
gcc-591b15bb1c185e2364e4e2ed65d1bebb48fbfb2b.tar.bz2
(expand_increment): Call save_expr on inner expression if
it is itself an increment expression. From-SVN: r5115
-rw-r--r--gcc/expr.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index bb31906..713f7d4 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -6940,6 +6940,12 @@ expand_increment (exp, post)
&& (TREE_CODE (TREE_OPERAND (incremented, 0)) != INDIRECT_REF
|| DECL_BIT_FIELD (TREE_OPERAND (incremented, 1)))))
incremented = stabilize_reference (incremented);
+ /* Nested *INCREMENT_EXPRs can happen in C++. We must force innermost
+ ones into save exprs so that they don't accidentally get evaluated
+ more than once by the code below. */
+ if (TREE_CODE (incremented) == PREINCREMENT_EXPR
+ || TREE_CODE (incremented) == PREDECREMENT_EXPR)
+ incremented = save_expr (incremented);
/* Compute the operands as RTX.
Note whether OP0 is the actual lvalue or a copy of it: