https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82319
--- Comment #5 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 25 Sep 2017, ygribov at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82319 > > --- Comment #4 from Yury Gribov <ygribov at gcc dot gnu.org> --- > (In reply to Richard Biener from comment #3) > > Testing the following to match comments. > > Thanks, so the assertion proved to be useful in the end. > > I'd rather change cst_int_p to be > bool cst_int_p = real_identical (&icst, cst) && ! real_isnan (cst); > and then maybe add a special case for nan case when expanding the pattern. > I'll take a look in the evening and hopefully send a patch tomorrow if that's > fine? Sure. But I think you miss a check whether the CST fits in the integer type so a testcase with int == 1e30 would still fail? It's hard to write one doing short == 100000.