diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-10-04 10:50:19 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-10-04 10:50:19 +0000 |
commit | f95810b50bab4e1397e51b12aa8e73cbf6046a47 (patch) | |
tree | b7c37bc4d6cbafc2c9e402dc66394ed26dd746e3 /gcc/fold-const.c | |
parent | 707905d0773e5a8eebb9ba65164f43dc08c658b1 (diff) | |
download | gcc-f95810b50bab4e1397e51b12aa8e73cbf6046a47.zip gcc-f95810b50bab4e1397e51b12aa8e73cbf6046a47.tar.gz gcc-f95810b50bab4e1397e51b12aa8e73cbf6046a47.tar.bz2 |
PR82413: Mismatched precisions in build_range_check
build_range_check explicitly allows LOW and HIGH to be a different type
from EXP, so we need to use w::to_widest when comparing a value based on
HIGH with a value based on EXP's type.
2017-10-04 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
PR tree-optimization/82413
* fold-const.c (build_range_check): Use widest_int when comparing
the maximum ETYPE value with HIGH.
gcc/testsuite/
PR tree-optimization/82413
* g++.dg/pr82413.C: New test.
From-SVN: r253401
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r-- | gcc/fold-const.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fa9d1bb..ae037ce 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -4851,7 +4851,7 @@ build_range_check (location_t loc, tree type, tree exp, int in_p, { int prec = TYPE_PRECISION (etype); - if (wi::mask (prec - 1, false, prec) == high) + if (wi::mask <widest_int> (prec - 1, false) == wi::to_widest (high)) { if (TYPE_UNSIGNED (etype)) { |