[Bug middle-end/64182] [5 Regression] wide-int rounding division is broken

rsandifo at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Dec 10 14:51:00 GMT 2014


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64182

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2014-12-10
     Ever confirmed|0                           |1

--- Comment #3 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> Created attachment 34222 [details]
> gcc5-pr64182.patch
> 
> So like this (completely untested so far)?  I'm hoping that remainder can't
> be ever for signed numbers equal to minimum signed value and thus hopefully
> wi::abs nor lshift of that by 1 should overflow.  For UNSIGNED, not sure if
> wi::neg_p () is the right test for whether lshift by 1 will overflow.

Looks OK to me, but I wonder if we could just use:

  wi::geu_p (y, remainder - y)

for unsigned, and similarly with abses for signed, which avoids having to worry
about overflow.  Will try.



More information about the Gcc-bugs mailing list