Re: clang-10 warning in hash.c

2020-01-30 Thread Tim Rühsen
Hi Bruno, On 1/27/20 2:09 PM, Bruno Haible wrote: >> Not sure if the compiler is correct here, but maybe worth a look: >> >> hash.c:549:11: error: implicit conversion from 'unsigned long' to >> 'float' changes value from 18446744073709551615 to 18446744073709551616 >> [-Werror,-Wimplicit-int-float

Re: clang-10 warning in hash.c

2020-01-27 Thread Bruno Haible
I wrote: > And I dislike it because the transformation is correct only if > (float) SIZE_MAX >= SIZE_MAX. In the other case, > (float) SIZE_MAX < SIZE_MAX, the transformation is incorrect > [think of the particular value new_candidate = (float) SIZE_MAX]. Ouch, I was assuming that the comparison s

Re: clang-10 warning in hash.c

2020-01-27 Thread Bruno Haible
Paul Eggert wrote: > In the past I've worked around problems like these by writing things > like "SIZE_MAX + 1.0f <= new_candidate" instead of "SIZE_MAX <= > new_candidate" This may deserve a warning that adding 1.0f does not change the value. > Presumably the Clang folks want us to insert a ca

Re: clang-10 warning in hash.c

2020-01-27 Thread Paul Eggert
On 1/27/20 5:09 AM, Bruno Haible wrote: IMO you should file a ticket with the clang people. That sounds appropriate. In the past I've worked around problems like these by writing things like "SIZE_MAX + 1.0f <= new_candidate" instead of "SIZE_MAX <= new_candidate" (partly under the argument

Re: clang-10 warning in hash.c

2020-01-27 Thread Bruno Haible
Hi Tim, > Not sure if the compiler is correct here, but maybe worth a look: > > hash.c:549:11: error: implicit conversion from 'unsigned long' to > 'float' changes value from 18446744073709551615 to 18446744073709551616 > [-Werror,-Wimplicit-int-float-conversion] > if (SIZE_MAX <= new_candi

clang-10 warning in hash.c

2020-01-27 Thread Tim Rühsen
Not sure if the compiler is correct here, but maybe worth a look: hash.c:549:11: error: implicit conversion from 'unsigned long' to 'float' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-int-float-conversion] if (SIZE_MAX <= new_candidate) ^