aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey A Law <law@cygnus.com>1999-10-19 08:40:05 +0000
committerJeff Law <law@gcc.gnu.org>1999-10-19 02:40:05 -0600
commit233314e2144799bf4172eba93cada379a2cae36c (patch)
tree2de316db0c30702de3ca9cc3ad5c03318fd86362
parente87b62d96da654acfeea3765d1f046a7186d804c (diff)
downloadgcc-233314e2144799bf4172eba93cada379a2cae36c.zip
gcc-233314e2144799bf4172eba93cada379a2cae36c.tar.gz
gcc-233314e2144799bf4172eba93cada379a2cae36c.tar.bz2
Revert this change. Gavin's patch to operand_equal_p is a better fix.
* fold-const.c (fold_range_test): Do not try to fold the range test if the rhs or lhs has side effects. Fri Sep 17 15:05:27 1999 Gavin Romig-Koch <gavin@cygnus.com> * fold-const.c (operand_equal_p): Pay attention to side effects. From-SVN: r30082
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/fold-const.c10
2 files changed, 13 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 59c2ada..587dbbc 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
Tue Oct 19 02:03:00 1999 Jeffrey A Law (law@cygnus.com)
+ Revert this change. Gavin's patch to operand_equal_p is a better fix.
+ * fold-const.c (fold_range_test): Do not try to fold the range
+ test if the rhs or lhs has side effects.
+
+ Fri Sep 17 15:05:27 1999 Gavin Romig-Koch <gavin@cygnus.com>
+ * fold-const.c (operand_equal_p): Pay attention to side effects.
+
* reg-stack.c (stack_result): Aggregates are not returned in
stack registers.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index c9778ba..55dcf9b 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -2177,6 +2177,12 @@ operand_equal_p (arg0, arg1, only_const)
TREE_OPERAND (arg1, 0), 0));
case 'r':
+ /* If either of the pointer (or reference) expressions we are dereferencing
+ contain a side effect, these cannot be equal. */
+ if (TREE_SIDE_EFFECTS (arg0)
+ || TREE_SIDE_EFFECTS (arg1))
+ return 0;
+
switch (TREE_CODE (arg0))
{
case INDIRECT_REF:
@@ -3558,10 +3564,6 @@ fold_range_test (exp)
tree rhs = make_range (TREE_OPERAND (exp, 1), &in1_p, &low1, &high1);
tree tem;
- /* Fail if anything is volatile. */
- if (TREE_SIDE_EFFECTS (lhs) || TREE_SIDE_EFFECTS (rhs))
- return 0;
-
/* If this is an OR operation, invert both sides; we will invert
again at the end. */
if (or_op)