aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBernd Schmidt <bernds@redhat.co.uk>2000-11-24 17:45:04 +0000
committerBernd Schmidt <bernds@gcc.gnu.org>2000-11-24 17:45:04 +0000
commit7cf5c9e1a0bb132d20abd543e7d991f2f2e51350 (patch)
treec4752b2cd4a02d7beebff1142d13df82c0635c8d /gcc
parentff6534ad165fa1e463d001240f14709327b27b1e (diff)
downloadgcc-7cf5c9e1a0bb132d20abd543e7d991f2f2e51350.zip
gcc-7cf5c9e1a0bb132d20abd543e7d991f2f2e51350.tar.gz
gcc-7cf5c9e1a0bb132d20abd543e7d991f2f2e51350.tar.bz2
Fix crash in fold_range_test
From-SVN: r37712
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog2
-rw-r--r--gcc/fold-const.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 2c12a96..eb50265 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index 9284a19..aaff05f 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -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))