py/objfloat: Fix undefined integer behavior hashing negative zero.

Under ubsan, when evaluating hash(-0.) the following diagnostic occurs:

    ../../py/objfloat.c:102:15: runtime error: negation of
    -9223372036854775808 cannot be represented in type 'mp_int_t' (aka
    'long'); cast to an unsigned type to negate this value to itself

So do just that, to tell the compiler that we want to perform this
operation using modulo arithmetic rules.
pull/3798/head
Jeff Epler 2018-05-19 13:13:02 -05:00 zatwierdzone przez Damien George
rodzic c4dafcef4f
commit 95e43efc99
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -99,7 +99,7 @@ typedef uint32_t mp_float_uint_t;
}
if (u.p.sgn) {
val = -val;
val = -(mp_uint_t)val;
}
return val;