PR82413: Mismatched precisions in build_range_check
authorRichard Sandiford <richard.sandiford@linaro.org>
Wed, 4 Oct 2017 10:50:19 +0000 (10:50 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Wed, 4 Oct 2017 10:50:19 +0000 (10:50 +0000)
commitf95810b50bab4e1397e51b12aa8e73cbf6046a47
treeb7c37bc4d6cbafc2c9e402dc66394ed26dd746e3
parent707905d0773e5a8eebb9ba65164f43dc08c658b1
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
gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pr82413.C [new file with mode: 0644]