summaryrefslogtreecommitdiffstats
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 13:56:00 +0000
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>2007-06-06 13:56:00 +0000
commitbdc68addfd00b2d8343bbd5e6da3e76da1035ba0 (patch)
treea22559350750655bb42ab1c2f1645ea134ffff68 /gcc/fold-const.c
parent5ccaabd9545b27dfd8bd2388295bcf1f9ccc1275 (diff)
downloadppe42-gcc-bdc68addfd00b2d8343bbd5e6da3e76da1035ba0.tar.gz
ppe42-gcc-bdc68addfd00b2d8343bbd5e6da3e76da1035ba0.zip
./:
* fold-const.c (merge_ranges): If range_successor or range_predecessor fail, just return 0. testsuite/: * g++.dg/conversion/enum1.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@125486 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index af48916601c..bc6d6022415 100644
--- a/gcc/fold-const.c
+++ b/gcc/fold-const.c
@@ -4549,13 +4549,24 @@ merge_ranges (int *pin_p, tree *plow, tree *phigh, int in0_p, tree low0,
{
low = range_successor (high1);
high = high0;
- in_p = (low != 0);
+ in_p = 1;
+ if (low == 0)
+ {
+ /* We are in the weird situation where high0 > high1 but
+ high1 has no successor. Punt. */
+ return 0;
+ }
}
else if (! subset || highequal)
{
low = low0;
high = range_predecessor (low1);
- in_p = (high != 0);
+ in_p = 1;
+ if (high == 0)
+ {
+ /* low0 < low1 but low1 has no predecessor. Punt. */
+ return 0;
+ }
}
else
return 0;
@@ -4575,7 +4586,12 @@ merge_ranges (int *pin_p, tree *plow, tree *phigh, int in0_p, tree low0,
{
low = range_successor (high0);
high = high1;
- in_p = (low != 0);
+ in_p = 1;
+ if (low == 0)
+ {
+ /* high1 > high0 but high0 has no successor. Punt. */
+ return 0;
+ }
}
}
OpenPOWER on IntegriCloud