aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.co.uk>2000-11-24 11:49:46 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2000-11-24 11:49:46 +0000
commit235cfbc40ffdc27a7578595042e4c1965e2000ed (patch)
tree4a5a8c5bbd55425bdea0737edf13bbc8e8817f59 /gcc/fold-const.c
parent58ecb5e2cd33addcf73d70f87d0f3a5ff221e226 (diff)
downloadgcc-235cfbc40ffdc27a7578595042e4c1965e2000ed.zip
gcc-235cfbc40ffdc27a7578595042e4c1965e2000ed.tar.gz
gcc-235cfbc40ffdc27a7578595042e4c1965e2000ed.tar.bz2
Overhaul sequence point warnings (again)
From-SVN: r37706
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index f5b2699..9284a19 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -5962,7 +5962,9 @@ fold (expr)
/* If either arg is constant true, drop it. */
if (TREE_CODE (arg0) == INTEGER_CST && ! integer_zerop (arg0))
return non_lvalue (convert (type, arg1));
- if (TREE_CODE (arg1) == INTEGER_CST && ! integer_zerop (arg1))
+ if (TREE_CODE (arg1) == INTEGER_CST && ! integer_zerop (arg1)
+ /* Preserve sequence points. */
+ && (code != TRUTH_ANDIF_EXPR || ! TREE_SIDE_EFFECTS (arg0)))
return non_lvalue (convert (type, arg0));
/* If second arg is constant zero, result is zero, but first arg
must be evaluated. */
@@ -6048,7 +6050,9 @@ fold (expr)
/* If either arg is constant zero, drop it. */
if (TREE_CODE (arg0) == INTEGER_CST && integer_zerop (arg0))
return non_lvalue (convert (type, arg1));
- if (TREE_CODE (arg1) == INTEGER_CST && integer_zerop (arg1))
+ if (TREE_CODE (arg1) == INTEGER_CST && integer_zerop (arg1)
+ /* Preserve sequence points. */
+ && (code != TRUTH_ORIF_EXPR || ! TREE_SIDE_EFFECTS (arg0)))
return non_lvalue (convert (type, arg0));
/* If second arg is constant true, result is true, but we must
evaluate first arg. */