Fix crash in fold_range_test
authorBernd Schmidt <bernds@redhat.co.uk>
Fri, 24 Nov 2000 17:45:04 +0000 (17:45 +0000)
committerBernd Schmidt <bernds@gcc.gnu.org>
Fri, 24 Nov 2000 17:45:04 +0000 (17:45 +0000)
From-SVN: r37712

gcc/ChangeLog
gcc/fold-const.c

index 2c12a963f0d2d48d179e3efd4941c2a139d8909b..eb50265a21d4471b3784a1f6d33068f15f492b53 100644 (file)
@@ -1,5 +1,7 @@
 2000-11-24  Bernd Schmidt  <bernds@redhat.co.uk>
 
+       * fold-const.c (fold_range_test): Avoid crash if LHS or RHS is null.
+
        * reload1.c (conflicts_with_override): New function.
        (emit_input_reload_insns): Use it to tighten test for validity
        of substituting into output of previous insn.
index 9284a1943a97e69c5b0ccf894239a63cfac28047..aaff05f4d757089f4cca5c004a83e9ff7cccc8ce 100644 (file)
@@ -3780,6 +3780,7 @@ fold_range_test (exp)
      short-circuited branch and the underlying object on both sides
      is the same, make a non-short-circuit operation.  */
   else if (BRANCH_COST >= 2
+          && lhs != 0 && rhs != 0
           && (TREE_CODE (exp) == TRUTH_ANDIF_EXPR
               || TREE_CODE (exp) == TRUTH_ORIF_EXPR)
           && operand_equal_p (lhs, rhs, 0))