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.
This commit is contained in:
Jeff Epler 2018-05-19 13:13:02 -05:00 committed by Damien George
parent c4dafcef4f
commit 95e43efc99
1 changed files with 1 additions and 1 deletions

View File

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