minor noises made by gcc and -std=iso9899:1999 with -Wall -pedantic -Wextra -pedantic-errors

Vincent Lefevre vincent at vinc17.net
Mon Jul 1 11:36:37 UTC 2019


On 2019-07-01 13:13:12 +0200, Torbjorn Granlund wrote:
> Dennis Clarke <dclarke at blastwave.org> writes:
> 
>   make: *** [Makefile:775: all] Error 2
>   Command exited with non-zero status 2
> 
>   Where I know we have seen that before.
> 
> If some compiler switches yield warnings, please analyse them carefully
> and if you conclude that there is a real problem with GMP, let us know!

However the GMP code is poorly written.

  mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1);

What's the point of the cast to size_t?

Moreover, GMP favors signed arithmetic with a signed type mp_size_t,
thus artificially switching to unsigned arithmetic with this cast is
a bad idea.

-- 
Vincent Lefèvre <vincent at vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


More information about the gmp-discuss mailing list