You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the norm, casting a int64_t to a int32_t (or any signed integral type to a smaller signed integral type) is 'implementation defined' until C++20 (ref: cppreference.com).
Some code of the class Integer (src/kernel/gmp++) can leads to such casts.
For example, in the method to cast an Integer into a int32_t on 64-bit machine (or any machine with sizeof(long int) = sizeof (int64_t)):
According to the norm, casting a int64_t to a int32_t (or any signed integral type to a smaller signed integral type) is 'implementation defined' until C++20 (ref: cppreference.com).
Some code of the class Integer (
src/kernel/gmp++
) can leads to such casts.For example, in the method to cast an Integer into a int32_t on 64-bit machine (or any machine with
sizeof(long int) = sizeof (int64_t)
):givaro/src/kernel/gmp++/gmp++_int_misc.C
Lines 385 to 388 in 6fdc2a0
In this case the output of mpz_get_si is a signed integral type of 64 bits and is casted into a signed integral type of 32 bits.
I think a more comprehensive proof-reading of the code in gmp++ is necessary to catch other similar problems.
The text was updated successfully, but these errors were encountered: