PATCH: Bad signed int to long long conversion

Marc Glisse marc.glisse at inria.fr
Thu Feb 9 15:10:43 CET 2012


On Thu, 9 Feb 2012, Torbjorn Granlund wrote:

> Marc Glisse <marc.glisse at inria.fr> writes:
>
>  On Thu, 1 Dec 2011, Torbjorn Granlund wrote:
>
>  > I don't mind that somebody patches up all occurences of signed negation
>  > where the smallest negative value could hypothetically appear.
>
>  I don't know about "all occurences", but if there aren't any
>  objections I plan to commit the patch attached.
>
>  (I checked and gcc produces the same code for -1-(long)l as for
>  (long)~l, even at -O0)
>
> This patch seems to be pending still.  I haven't looked at it carefully.
> Does it solve real problems out there?

It seems to solve the problem originally reported to gcc bugzilla, and 
reported on gmp-bugs this week, which seems to concern only gcc-4.7 on 
platforms where sizeof(long)<sizeof(mp_limb_t) (and even then I am not 
sure everyone is affected).

> Then perhaps we ought to include
> this for 5.0.4?

I am at a workshop this week and can't do much until Monday. The code is 
in ~glisse/minus-longmin on shell, feel free to take it. (I didn't want to 
push the change just before leaving, when I can't handle any possible 
consequence in the following days)

-- 
Marc Glisse


More information about the gmp-bugs mailing list