aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1994-12-10 16:05:49 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1994-12-10 16:05:49 -0500
commit4ab3cb6597c6a02d6795975c3abf8f1d4012a8ce (patch)
tree202ebf142edada8be0094555e176a13c7470df3e /gcc
parent5f8997b9578b4843f6d9e8e24b45191993c8166c (diff)
downloadgcc-4ab3cb6597c6a02d6795975c3abf8f1d4012a8ce.zip
gcc-4ab3cb6597c6a02d6795975c3abf8f1d4012a8ce.tar.gz
gcc-4ab3cb6597c6a02d6795975c3abf8f1d4012a8ce.tar.bz2
(pedantic_omit_one_operand): New function.
(fold, case COND_EXPR): Use it instead of calling pedantic_non_lvalue on the result of omit_one_operand. From-SVN: r8641
Diffstat (limited to 'gcc')
-rw-r--r--gcc/fold-const.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index e49fcfb..ab717b8 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -63,6 +63,7 @@ static int operand_equal_for_comparison_p PROTO((tree, tree, tree));
static int twoval_comparison_p PROTO((tree, tree *, tree *, int *));
static tree eval_subst PROTO((tree, tree, tree, tree, tree));
static tree omit_one_operand PROTO((tree, tree, tree));
+static tree pedantic_omit_one_operand PROTO((tree, tree, tree));
static tree distribute_bit_expr PROTO((enum tree_code, tree, tree, tree));
static tree make_bit_field_ref PROTO((tree, tree, int, int, int));
static tree optimize_bit_field_compare PROTO((enum tree_code, tree,
@@ -1997,6 +1998,22 @@ omit_one_operand (type, result, omitted)
return non_lvalue (t);
}
+
+/* Similar, but call pedantic_non_lvalue instead of non_lvalue. */
+
+static tree
+pedantic_omit_one_operand (type, result, omitted)
+ tree type, result, omitted;
+{
+ tree t = convert (type, result);
+
+ if (TREE_SIDE_EFFECTS (omitted))
+ return build (COMPOUND_EXPR, type, omitted, t);
+
+ return pedantic_non_lvalue (t);
+}
+
+
/* Return a simplified tree node for the truth-negation of ARG. This
never alters ARG itself. We assume that ARG is an operation that
@@ -4679,7 +4696,7 @@ fold (expr)
return pedantic_non_lvalue
(TREE_OPERAND (t, (integer_zerop (arg0) ? 2 : 1)));
else if (operand_equal_p (arg1, TREE_OPERAND (expr, 2), 0))
- return pedantic_non_lvalue (omit_one_operand (type, arg1, arg0));
+ return pedantic_omit_one_operand (type, arg1, arg0);
/* If the second operand is zero, invert the comparison and swap
the second and third operands. Likewise if the second operand