From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id D95741F466 for ; Mon, 27 Jan 2020 13:10:02 +0000 (UTC) Received: from localhost ([::1]:45060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iw49R-00076r-Ax for normalperson@yhbt.net; Mon, 27 Jan 2020 08:10:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46222) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iw49M-00076H-HA for bug-gnulib@gnu.org; Mon, 27 Jan 2020 08:09:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iw49L-0002qc-Gx for bug-gnulib@gnu.org; Mon, 27 Jan 2020 08:09:56 -0500 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::12]:12853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iw49K-0002nq-Rw for bug-gnulib@gnu.org; Mon, 27 Jan 2020 08:09:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1580130591; s=strato-dkim-0002; d=clisp.org; h=References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=FbpPio75uaqesPaIXN0CemNypxzpopidszzbQzZ4sDQ=; b=MonmEL9ToiM0qFQFkep33GtGDVCY12U5rcnkKoTBsxv7IDY3xsE267rzUjxVMVNY5U yyQr/3XqaGHya/U2uhBGqAqkW0FujyQlL+AsJ1GDLB9+kz97dwbFbOeQO8cQYqB4OOjn hvLG8pQUZHwG69sxfcODVY2IyfKMCVvJqfVlIUQq9rH4Sx3VVr+J041kuXMwSh+RYtIP GSm/V4hk7vjTUNEs7tDfhRPxn+Fdg8jYjAK4YG0CzOFuq7UeJOkvI3fFVWhbAhpNBQ4L Tpz30s1cSOA9ZgPvNzvPLxvrxACoBn+cHG5d+JpSHQ9SMTOAbnokDss1WaU9SLUjYTJx GYNQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH+AHjwLuWOH6fzxfs=" X-RZG-CLASS-ID: mo00 Received: from bruno.haible.de by smtp.strato.de (RZmta 46.1.7 DYNA|AUTH) with ESMTPSA id d0b1daw0RD9oF7r (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (curve X9_62_prime256v1 with 256 ECDH bits, eq. 3072 bits RSA)) (Client did not present a certificate); Mon, 27 Jan 2020 14:09:50 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: Re: clang-10 warning in hash.c Date: Mon, 27 Jan 2020 14:09:50 +0100 Message-ID: <3695940.OeVvW2AmiG@omega> User-Agent: KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a01:238:20a:202:5300::12 X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tim =?ISO-8859-1?Q?R=FChsen?= Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" 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_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 Bruno