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=-3.6 required=3.0 tests=AWL,BAYES_00, 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 E7F1C1F466 for ; Mon, 27 Jan 2020 20:21:19 +0000 (UTC) Received: from localhost ([::1]:50588 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwAso-0001fP-Fj for normalperson@yhbt.net; Mon, 27 Jan 2020 15:21:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:38188) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwAoh-0008BS-Pb for bug-gnulib@gnu.org; Mon, 27 Jan 2020 15:17:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwAog-0000qY-9T for bug-gnulib@gnu.org; Mon, 27 Jan 2020 15:17:03 -0500 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49294) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iwAog-0000om-4E for bug-gnulib@gnu.org; Mon, 27 Jan 2020 15:17:02 -0500 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 85C4F160072; Mon, 27 Jan 2020 12:16:58 -0800 (PST) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id Zg0oJVsCT4IV; Mon, 27 Jan 2020 12:16:57 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CEE1416007A; Mon, 27 Jan 2020 12:16:57 -0800 (PST) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 0SvhSvZOY-QH; Mon, 27 Jan 2020 12:16:57 -0800 (PST) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id B3A0C160072; Mon, 27 Jan 2020 12:16:57 -0800 (PST) Subject: Re: clang-10 warning in hash.c To: Bruno Haible , bug-gnulib@gnu.org References: <3695940.OeVvW2AmiG@omega> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Mon, 27 Jan 2020 12:16:57 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <3695940.OeVvW2AmiG@omega> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 131.179.128.68 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: =?UTF-8?Q?Tim_R=c3=bchsen?= Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" 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 that this better matches the mathematical comparison we're actually trying to do), but it sounds like Clang 10 would warn about that too. > Inserting a cast to 'double' > > if ((double) SIZE_MAX <= (double) new_candidate) > > would not help Presumably the Clang folks want us to insert a cast to 'float', e.g., "(float) SIZE_MAX <= new_candidate". However, I dislike casts because they're too powerful. If there's no way to pacify Clang without casting, then I suggest disabling the warning instead. In GCC, we already disable Clang's -Wswitch, -Wpointer-sign, -Wstring-plus-int and -Wunknown-attributes warnings, and perhaps after Clang 10 comes out we'll disable -Wimplicit-int-float-conversion too. Some diagnostics are just too much trouble to pacify.