This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/64182] [5 Regression] wide-int rounding division is broken
- From: "rsandifo at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 10 Dec 2014 14:51:41 +0000
- Subject: [Bug middle-end/64182] [5 Regression] wide-int rounding division is broken
- Auto-submitted: auto-generated
- References: <bug-64182-4 at http dot gcc dot gnu dot org/bugzilla/>
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.