fold-const.c (fold_range_test): Do not try to fold the range test if the rhs or lhs...
authorJeffrey A Law <law@cygnus.com>
Thu, 2 Sep 1999 09:37:20 +0000 (09:37 +0000)
committerJeff Law <law@gcc.gnu.org>
Thu, 2 Sep 1999 09:37:20 +0000 (03:37 -0600)
* fold-const.c (fold_range_test): Do not try to fold the range
test if the rhs or lhs has side effects.

From-SVN: r29058

gcc/ChangeLog
gcc/fold-const.c

index 42f596bbd4574b61fa17ded25f4f571eeae0c1ef..a40330ddf5620bccad74ea4eb248cd1cb182e6a8 100644 (file)
@@ -13,6 +13,9 @@ Thu Sep  2 00:43:59 1999  Finn Hakansson  <finn@axis.com>
 
 Thu Sep  2 00:06:43 1999  Jeffrey A Law  (law@cygnus.com)
 
+       * fold-const.c (fold_range_test): Do not try to fold the range
+       test if the rhs or lhs has side effects.
+
        * combine.c (simplify_rtx): Recognize another case of a synthesized
        sign extension.
 
index ed353f896271f451bf11124176c77c1cd03edbd5..3cde5f539b0762caecd0da25447d99162d2dd73e 100644 (file)
@@ -3560,6 +3560,10 @@ 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)