diff options
author | Jakub Jelinek <jakub@redhat.com> | 2002-12-06 08:07:57 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2002-12-06 08:07:57 +0100 |
commit | 61f6c84f21a542b10c4d915751f1fc4ec3d0f1ff (patch) | |
tree | a2ee5aa601c9c1faf0859c1a098aa1167a151400 /gcc/expr.c | |
parent | bf97847b372fb2d94eaa08ceda55a52b6907647b (diff) | |
download | gcc-61f6c84f21a542b10c4d915751f1fc4ec3d0f1ff.zip gcc-61f6c84f21a542b10c4d915751f1fc4ec3d0f1ff.tar.gz gcc-61f6c84f21a542b10c4d915751f1fc4ec3d0f1ff.tar.bz2 |
expr.c (expand_expr): Never modify exp in place.
* expr.c (expand_expr) <case COND_EXPR>: Never modify exp in place.
* gcc.c-torture/execute/20021204-1.c: New test.
From-SVN: r59881
Diffstat (limited to 'gcc/expr.c')
-rw-r--r-- | gcc/expr.c | 22 |
1 files changed, 7 insertions, 15 deletions
@@ -8618,6 +8618,7 @@ expand_expr (exp, target, tmode, modifier) && TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, 0))) == '<') { rtx result; + tree cond; optab boptab = (TREE_CODE (binary_op) == PLUS_EXPR ? (TYPE_TRAP_SIGNED (TREE_TYPE (binary_op)) ? addv_optab : add_optab) @@ -8627,20 +8628,14 @@ expand_expr (exp, target, tmode, modifier) : TREE_CODE (binary_op) == BIT_IOR_EXPR ? ior_optab : xor_optab); - /* If we had X ? A : A + 1, do this as A + (X == 0). - - We have to invert the truth value here and then put it - back later if do_store_flag fails. We cannot simply copy - TREE_OPERAND (exp, 0) to another variable and modify that - because invert_truthvalue can modify the tree pointed to - by its argument. */ + /* If we had X ? A : A + 1, do this as A + (X == 0). */ if (singleton == TREE_OPERAND (exp, 1)) - TREE_OPERAND (exp, 0) - = invert_truthvalue (TREE_OPERAND (exp, 0)); + cond = invert_truthvalue (TREE_OPERAND (exp, 0)); + else + cond = TREE_OPERAND (exp, 0); - result = do_store_flag (TREE_OPERAND (exp, 0), - (safe_from_p (temp, singleton, 1) - ? temp : NULL_RTX), + result = do_store_flag (cond, (safe_from_p (temp, singleton, 1) + ? temp : NULL_RTX), mode, BRANCH_COST <= 1); if (result != 0 && ! integer_onep (TREE_OPERAND (binary_op, 1))) @@ -8658,9 +8653,6 @@ expand_expr (exp, target, tmode, modifier) return expand_binop (mode, boptab, op1, result, temp, unsignedp, OPTAB_LIB_WIDEN); } - else if (singleton == TREE_OPERAND (exp, 1)) - TREE_OPERAND (exp, 0) - = invert_truthvalue (TREE_OPERAND (exp, 0)); } do_pending_stack_adjust (); |