From: "Tim Rühsen" <tim.ruehsen@gmx.de>
To: Bruno Haible <bruno@clisp.org>, bug-gnulib@gnu.org
Subject: Re: clang-10 warning in hash.c
Date: Thu, 30 Jan 2020 16:35:48 +0100 [thread overview]
Message-ID: <fa6c274d-d97b-add8-b55b-7b4bb279637b@gmx.de> (raw)
In-Reply-To: <3695940.OeVvW2AmiG@omega>
[-- Attachment #1.1: Type: text/plain, Size: 1580 bytes --]
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-conversion]
>> if (SIZE_MAX <= new_candidate)
>> ^~~~~~~~ ~~
>> /usr/include/stdint.h:227:22: note: expanded from macro 'SIZE_MAX'
>> # define SIZE_MAX (18446744073709551615UL)
>> ^~~~~~~~~~~~~~~~~~~~~~
>
> This warning is pointless, because
> - Since the next float below 18446744073709551616 = 0x10000000000000000
> would be 18446742974197923840 = 0xFFFFFF0000000000
> the comparison result is the same for the two values ...615 and ...616.
> - The compiler inserts the implicit conversion only because of the '<='
> operator.
> IMO you should file a ticket with the clang people.
>
> Inserting a cast to 'double'
>
> if ((double) SIZE_MAX <= (double) new_candidate)
>
> would not help, because
> the next double-float below 18446744073709551616 = 0x10000000000000000
> would be 18446744073709549568 = 0xFFFFFFFFFFFFF800
Thanks for the understandable explanation !
Sadly, bugs.llvm.org disabled self-registration. So they won't get a bug
report from me (looks like they want to encapsulate from the rest of the
world). Instead -Wno-implicit-int-float-conversion will be added to the
clang options.
Regards, Tim
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2020-01-30 15:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-27 10:58 clang-10 warning in hash.c Tim Rühsen
2020-01-27 13:09 ` Bruno Haible
2020-01-27 20:16 ` Paul Eggert
2020-01-27 21:03 ` Bruno Haible
2020-01-28 2:08 ` Bruno Haible
2020-01-30 15:35 ` Tim Rühsen [this message]
2020-01-30 17:50 ` bugs.llvm.org Bruno Haible
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa6c274d-d97b-add8-b55b-7b4bb279637b@gmx.de \
--to=tim.ruehsen@gmx.de \
--cc=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).