summaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-07 07:37:12 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-10-07 07:37:12 +0000
commita60e410741acf21eb810f4c182b31d6a52247bc9 (patch)
treed7b1d8da3e6a106a36561c0c86b098f57082381e /gcc/expr.c
parent8e31438220bc53a1a1a657d5f61dffa2e98ce500 (diff)
downloadgcc-a60e410741acf21eb810f4c182b31d6a52247bc9.tar.gz
PR c/7411
* expr.c (expand_expr) [PLUS]: Simplify after the operands have been expanded in EXPAND_NORMAL mode. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57882 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/expr.c')
-rw-r--r--gcc/expr.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 01c360315b8..e33d8145e1f 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7899,16 +7899,23 @@ expand_expr (exp, target, tmode, modifier)
}
}
+ if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
+ subtarget = 0;
+
/* No sense saving up arithmetic to be done
if it's all in the wrong mode to form part of an address.
And force_operand won't know whether to sign-extend or
zero-extend. */
if ((modifier != EXPAND_SUM && modifier != EXPAND_INITIALIZER)
|| mode != ptr_mode)
- goto binop;
-
- if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
- subtarget = 0;
+ {
+ op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
+ op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, 0);
+ temp = simplify_binary_operation (PLUS, mode, op0, op1);
+ if (temp)
+ return temp;
+ goto binop2;
+ }
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, modifier);
op1 = expand_expr (TREE_OPERAND (exp, 1), NULL_RTX, VOIDmode, modifier);