mpz_get_si: possible undefined behaviour? [Was: Micro-GMP]

Pedro Gimeno gmpdevel at formauri.es
Tue Dec 4 12:28:15 UTC 2018


Torbjörn Granlund wrote, On 2018-12-04 07:39:
> Marco Bodrato <bodrato at mail.dm.unipi.it> writes:
> 
>   But, what about the LONG_MIN == -LONG_MAX case?
>   The result is undefined, isn't it?
> 
> Does anybody (apart from Vincent) have access to such a machine?
> :-)

An assertion of LONG_MIN < -LONG_MAX should make the code safe in that case.

-- 
Pedro



More information about the gmp-devel mailing list