summaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-24 11:49:46 +0000
committerbernds <bernds@138bc75d-0d04-0410-961f-82ee72b054a4>2000-11-24 11:49:46 +0000
commit4e91a871c201bcffad88daabbd217ee99142a17c (patch)
tree4a5a8c5bbd55425bdea0737edf13bbc8e8817f59 /gcc/fold-const.c
parente53826a7fe250ee3a75c8c4919f8cd04fc7779c5 (diff)
downloadgcc-4e91a871c201bcffad88daabbd217ee99142a17c.tar.gz
Overhaul sequence point warnings (again)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37706 138bc75d-0d04-0410-961f-82ee72b054a4
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 f5b26993f4c..9284a1943a9 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. */