diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-12 15:21:34 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-08-12 15:21:34 +0000 |
commit | cab932e0f7e8c311fd9fac996bb95d1cec76bb64 (patch) | |
tree | 639f56221290e502c4e4cfc6c62da003331396f5 /gcc/fold-const.c | |
parent | 12c655b1e4ab9e522d575335b14d4c6fc6afc72e (diff) | |
download | gcc-cab932e0f7e8c311fd9fac996bb95d1cec76bb64.tar.gz |
PR middle-end/45262
* fold-const.c (make_range) <case NEGATE_EXPR>: Punt if
-a overflows. Normalize the range.
* gcc.c-torture/execute/pr45262.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163193 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 9ca5eff554e..d63411ea89a 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -3985,9 +3985,9 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh, n_high = range_binop (MINUS_EXPR, exp_type, build_int_cst (exp_type, 0), 0, low, 0); - low = n_low, high = n_high; - exp = arg0; - continue; + if (n_high != 0 && TREE_OVERFLOW (n_high)) + break; + goto normalize; case BIT_NOT_EXPR: /* ~ X -> -X - 1 */ @@ -4021,6 +4021,7 @@ make_range (tree exp, int *pin_p, tree *plow, tree *phigh, if (TYPE_OVERFLOW_UNDEFINED (arg0_type)) *strict_overflow_p = true; + normalize: /* Check for an unsigned range which has wrapped around the maximum value thus making n_high < n_low, and normalize it. */ if (n_low && n_high && tree_int_cst_lt (n_high, n_low)) |