From 591b15bb1c185e2364e4e2ed65d1bebb48fbfb2b Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Sun, 8 Aug 1993 15:48:15 -0700 Subject: [PATCH] (expand_increment): Call save_expr on inner expression if it is itself an increment expression. From-SVN: r5115 --- gcc/expr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/gcc/expr.c b/gcc/expr.c index bb31906f8c1..713f7d4eb77 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: -- 2.30.2