Two possibly relevant warnings in mpn/udiv_w_sdiv.c

Niels Möller nisse at
Sat Nov 26 23:13:59 CET 2011

Marian Kechlibar <marian.kechlibar at> writes:

> I have recently tried to compile the file with warnings turned to a high
> level, and the compiler alerted me to incorrect assignment. Namely,
> the lines           q = -1; and           q = -2;, very close to the end
> of the file, constitute assignment of a negative value to q, which may
> be of unsigned type (unsigned long etc.)

I think this should be properly sign-extended in case mp_limb_t is
larger than an int (but I would have to read the C spec to say for

As always, it would be helpful if you could say which compiler (and
flags) you were using, and quote the complete warning/error message.


Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.

More information about the gmp-devel mailing list