Commit f95810b5 by Richard Sandiford Committed by Richard Sandiford

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
parent 707905d0
2017-10-04 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/82413
* fold-const.c (build_range_check): Use widest_int when comparing
the maximum ETYPE value with HIGH.
2017-10-04 Wilco Dijkstra <wdijkstr@arm.com>
PR rtl-optimization/82396
......@@ -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))
{
......
2017-10-04 Richard Sandiford <richard.sandiford@linaro.org>
PR tree-optimization/82413
* g++.dg/pr82413.C: New test.
2017-10-04 Paul Thomas <pault@gcc.gnu.org>
PR fortran/77296
......
bool a;
int b;
void c() { b &&a <= 0; }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment