From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-io1-xd35.google.com (mail-io1-xd35.google.com [IPv6:2607:f8b0:4864:20::d35]) by sourceware.org (Postfix) with ESMTPS id 9C5D43857C4E for ; Tue, 25 Jan 2022 00:42:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9C5D43857C4E Received: by mail-io1-xd35.google.com with SMTP id y84so5381876iof.0 for ; Mon, 24 Jan 2022 16:42:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=oRNyn4dN+Zv+d5A3QY2MrmRk7/GXTdc7E8NyBgUCuW0=; b=RTq3LxESoV62YZOpmlWF4kMOj9behXb1eb4LQuSeyayHG1Ja56nSNLKgXxyZm/rRp1 aoFfmGaUdhEUUREpKYS6X3tneoGikEkenIZgtCib7gZyb6h7zuDpRgvEWGbxzHgOq5qh Q67bjnTpAFrk9j6lz2ZrJN1b8p5MMDhATgaVlgjAm5/OmcaMhwSigQDjZQFsAI7oVTdw A2kS5s9pBWryqeA+fC5qMA9j0t6zXTSn+FTGoF4kYODWoQCNSmPjfpwo6SxcjDvTdIJK f9N/ym4TATRZtYmbqiY1/NBC7bBRX72ia5R98cpAoR9FYm7hnl8UKrf6TOWMbV3z7NBm rqOQ== X-Gm-Message-State: AOAM530imbEa2w/eAi3tAGmv+6Zd5U63E9BdoGjHDjXwXwzw64OpBmhH EUoX52xxV2g76OOM9GxU/v8= X-Google-Smtp-Source: ABdhPJzlxM5dHwsG0BCBh7zrUGlxz30GyzIKAy9VfGFN/VsuCFEpXtf9jV7Ifek+/nlVpMHXc9G2FA== X-Received: by 2002:a02:6289:: with SMTP id d131mr8878533jac.61.1643071374830; Mon, 24 Jan 2022 16:42:54 -0800 (PST) Received: from [192.168.0.41] (97-118-100-142.hlrn.qwest.net. [97.118.100.142]) by smtp.gmail.com with ESMTPSA id g11sm6984923iom.45.2022.01.24.16.42.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Jan 2022 16:42:54 -0800 (PST) Message-ID: <62758b96-42b1-c199-0bf1-975ca4b70cb0@gmail.com> Date: Mon, 24 Jan 2022 17:42:53 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH] avoid -Wuse-after-free [BZ #26779] Content-Language: en-US To: Paul Eggert Cc: libc-alpha@sourceware.org References: <6c44a5a2-ed1e-abfe-2ead-9ddb6a97b8fc@gmail.com> From: Martin Sebor In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Jan 2022 00:42:57 -0000 On 1/21/22 17:42, Paul Eggert wrote: > On 1/21/22 15:14, Martin Sebor wrote: >>> >> >> That does look cleaner although it wasn't entirely obvious to me >> from looking at the code that it's the same.  Unfortunately, it >> doesn't help.  GCC replaces the bool variable with the equality >> test of the two pointers, and the warning points that out. > > That's a GCC bug. > >> Pedantically speaking it's a bug in GCC that it does that but >> I doubt anyone would care to do anything about it. > > You might be surprised; they do fix bugs in this area. If I could > reproduce the bug I'd file a bug report, but my GCC doesn't complain so > I guess it's up to you.... I opened a GCC bug for the record: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104215 GCC 12 is now in its regression-fixing stage so to get it fixed we'd need to make it a regression. That's usually only done for bugs that trigger under conditions where they didn't before. >> his only >> happens at level 3 (i.e., above the default 2), so if you want >> a clean build at that level you can either take the patch as is >> or use #pragma GCC diagnostic to suppress the warning.  Otherwise, >> if all you care about is -Wall, then you can drop this part of >> the patch. > > We shouldn't drop the patch or use a pragma, since this is a genuine bug > in glibc that should get fixed. If the only option is to use the patch > as-is then let's do that. Though I do wish the GCC bug were fixed. As do I, but I'm not holding my breath. I will post an updated/broken down patch series shortly. Martin