https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82413
--- Comment #5 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> --- Author: rsandifo Date: Wed Oct 4 10:50:19 2017 New Revision: 253401 URL: https://gcc.gnu.org/viewcvs?rev=253401&root=gcc&view=rev Log: 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.sandif...@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. Added: trunk/gcc/testsuite/g++.dg/pr82413.C Modified: trunk/gcc/ChangeLog trunk/gcc/fold-const.c trunk/gcc/testsuite/ChangeLog