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.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,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 0E7FE1F8C6 for ; Mon, 23 Aug 2021 21:04:58 +0000 (UTC) Received: from localhost ([::1]:37614 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mIH7o-0003KG-Oi for normalperson@yhbt.net; Mon, 23 Aug 2021 17:04:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53678) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIH7k-0003Ju-J6 for bug-gnulib@gnu.org; Mon, 23 Aug 2021 17:04:52 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:44970) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mIH7h-0001Og-Td for bug-gnulib@gnu.org; Mon, 23 Aug 2021 17:04:52 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 37983160060; Mon, 23 Aug 2021 14:04:46 -0700 (PDT) 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 8_IYQN65e4e0; Mon, 23 Aug 2021 14:04:45 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 6B30B160083; Mon, 23 Aug 2021 14:04:45 -0700 (PDT) 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 arrjN0q2CU-9; Mon, 23 Aug 2021 14:04:45 -0700 (PDT) Received: from [192.168.1.9] (cpe-172-91-119-151.socal.res.rr.com [172.91.119.151]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 42F20160060; Mon, 23 Aug 2021 14:04:45 -0700 (PDT) To: Darren Kenny References: <3932753cd7929507688d341754fae944dac9a983.1624030621.git.darren.kenny@oracle.com> <4cec2520-759b-cb6d-172f-0120f42a4cfe@cs.ucla.edu> From: Paul Eggert Organization: UCLA Computer Science Department Subject: Re: [PATCH 3/3] lib/regexec: Resolve unused variable Message-ID: Date: Mon, 23 Aug 2021 14:04:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------4CA3F3AED10B92B8E1C70509" Content-Language: en-US Received-SPF: pass client-ip=131.179.128.68; envelope-from=eggert@cs.ucla.edu; helo=zimbra.cs.ucla.edu X-Spam_score_int: -61 X-Spam_score: -6.2 X-Spam_bar: ------ X-Spam_report: (-6.2 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-2.023, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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: bug-gnulib@gnu.org Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" This is a multi-part message in MIME format. --------------4CA3F3AED10B92B8E1C70509 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable On 8/23/21 3:38 AM, Darren Kenny wrote: > What I did here was to not overwrite the value if DEBUG is set, > since it appeared to never be checked anyway within the for-loop. Yes, but although your patch pacified Coverity I still don't understand=20 exactly why. I'd like to get to the bottom of it before continuing. > I can only assume (pun not intended) that this > is ending up as a no-op for our build, which means that Coverity sees i= t > as never being read after the for-loop. I'm working blind here, since Coverity's documentation is secret, which=20 means you'll need to help out by reading its documentation and/or=20 running Coverity yourself. Can you do that and let us know the following? * What values does Coverity define the macros __GNUC__ and=20 __GNUC_MINOR__ to? Or does it leave these symbols undefined? * Similarly for _MSC_VER (defined by Microsoft C compilers). * Does Coverity support the __builtin_unreachable and/or __builtin_trap=20 functions, like GCC does? (See their use in verify.h.) * Does Coverity support __assume, like Microsoft C does? (Also see=20 verify.h.) * Does Coverity support __has_builtin, like GCC and Clang do? (Again,=20 see verify.h.) * Are you compiling with -DGCC_LINT and/or -Dlint? * Does the attached patch work for you? If not, why not, and what sort=20 of improvements could be made? Thanks. --------------4CA3F3AED10B92B8E1C70509 Content-Type: text/x-patch; charset=UTF-8; name="coverity2.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="coverity2.diff" diff --git a/lib/verify.h b/lib/verify.h index a8ca59b09..3cd71b280 100644 --- a/lib/verify.h +++ b/lib/verify.h @@ -305,6 +305,8 @@ template --enable-gcc-warnings, which compiles with -Dlint. It's nicer when 'assume' silences warnings even with older GCCs. */ # define assume(R) ((R) ? (void) 0 : __builtin_trap ()) +#elif defined __COVERITY__ +# define assume(R) ((R) ? (void) 0 : __coverity_panic__ ()) #else /* Some tools grok NOTREACHED, e.g., Oracle Studio 12.6. */ # define assume(R) ((R) ? (void) 0 : /*NOTREACHED*/ (void) 0) --------------4CA3F3AED10B92B8E1C70509--