summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-27 12:36:43 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2009-09-27 12:36:43 +0000
commitd5518ed987a5cdbf23d5c3d9294319f532f6678a (patch)
tree66dacc33dc02bdfc687cd79b0deb3eb58a538bdd /gcc/fold-const.c
parent8984ffefb514e5e5faf5cfecb9dbe901dba447a1 (diff)
downloadgcc-d5518ed987a5cdbf23d5c3d9294319f532f6678a.tar.gz
* fold-const.c (maybe_lvalue_p): Return false for M(IN|AX)_EXPR.
(extract_muldiv_1) <MINUS_EXPR>: Swap operands if necessary. * stor-layout.c (layout_type) <ARRAY_TYPE>: Do not take the maximum of the length and zero. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152217 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index d754bee2581..b080d85b471 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2830,8 +2830,6 @@ maybe_lvalue_p (const_tree x)
case TARGET_EXPR:
case COND_EXPR:
case BIND_EXPR:
- case MIN_EXPR:
- case MAX_EXPR:
break;
default:
@@ -6512,7 +6510,19 @@ extract_muldiv_1 (tree t, tree c, enum tree_code code, tree wide_type,
/* If this was a subtraction, negate OP1 and set it to be an addition.
This simplifies the logic below. */
if (tcode == MINUS_EXPR)
- tcode = PLUS_EXPR, op1 = negate_expr (op1);
+ {
+ tcode = PLUS_EXPR, op1 = negate_expr (op1);
+ /* If OP1 was not easily negatable, the constant may be OP0. */
+ if (TREE_CODE (op0) == INTEGER_CST)
+ {
+ tree tem = op0;
+ op0 = op1;
+ op1 = tem;
+ tem = t1;
+ t1 = t2;
+ t2 = tem;
+ }
+ }
if (TREE_CODE (op1) != INTEGER_CST)
break;