summaryrefslogtreecommitdiffstats
path: root/contrib/gcc/fold-const.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-12-04 15:42:16 +0000
committerobrien <obrien@FreeBSD.org>2002-12-04 15:42:16 +0000
commit7a1080fa5c329ea8a9505e51ce151719955bcfa2 (patch)
tree78b77287e56e2a87be73638176124be85a8fc6c7 /contrib/gcc/fold-const.c
parentef3bb1318428b8cfb1c8287f61b9b1f23f9bf0b5 (diff)
downloadFreeBSD-src-7a1080fa5c329ea8a9505e51ce151719955bcfa2.zip
FreeBSD-src-7a1080fa5c329ea8a9505e51ce151719955bcfa2.tar.gz
Gcc 3.2.1 release virgin vendor import. (19-Nov-2002)
Diffstat (limited to 'contrib/gcc/fold-const.c')
-rw-r--r--contrib/gcc/fold-const.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/contrib/gcc/fold-const.c b/contrib/gcc/fold-const.c
index a7e1e28..926581c 100644
--- a/contrib/gcc/fold-const.c
+++ b/contrib/gcc/fold-const.c
@@ -4869,6 +4869,7 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
/* And these are the types of the expressions. */
tree lhs_type = type;
tree rhs_type = type;
+ int save = 0;
if (cond_first_p)
{
@@ -4927,11 +4928,12 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
if an arm is a COND_EXPR since we get exponential behavior
in that case. */
- if (TREE_CODE (arg) != SAVE_EXPR && ! TREE_CONSTANT (arg)
- && global_bindings_p () == 0
- && ((TREE_CODE (arg) != VAR_DECL
- && TREE_CODE (arg) != PARM_DECL)
- || TREE_SIDE_EFFECTS (arg)))
+ if (TREE_CODE (arg) == SAVE_EXPR)
+ save = 1;
+ else if (! TREE_CONSTANT (arg)
+ && global_bindings_p () == 0
+ && ((TREE_CODE (arg) != VAR_DECL && TREE_CODE (arg) != PARM_DECL)
+ || TREE_SIDE_EFFECTS (arg)))
{
if (TREE_CODE (true_value) != COND_EXPR)
lhs = fold (build (lhs_code, lhs_type, *true_lhs, *true_rhs));
@@ -4941,7 +4943,11 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
if ((lhs == 0 || ! TREE_CONSTANT (lhs))
&& (rhs == 0 || !TREE_CONSTANT (rhs)))
- arg = save_expr (arg), lhs = rhs = 0;
+ {
+ arg = save_expr (arg);
+ lhs = rhs = 0;
+ save = 1;
+ }
}
if (lhs == 0)
@@ -4951,7 +4957,7 @@ fold_binary_op_with_conditional_arg (code, type, cond, arg, cond_first_p)
test = fold (build (COND_EXPR, type, test, lhs, rhs));
- if (TREE_CODE (arg) == SAVE_EXPR)
+ if (save)
return build (COMPOUND_EXPR, type,
convert (void_type_node, arg),
strip_compound_expr (test, arg));
@@ -6535,7 +6541,7 @@ fold (expr)
else if (TREE_INT_CST_HIGH (arg1) == -1
&& (TREE_INT_CST_LOW (arg1)
- == ((unsigned HOST_WIDE_INT) 1 << (width - 1)))
+ == ((unsigned HOST_WIDE_INT) -1 << (width - 1)))
&& ! TREE_UNSIGNED (TREE_TYPE (arg1)))
switch (TREE_CODE (t))
{
OpenPOWER on IntegriCloud