From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from weasel.tulip.relay.mailchannels.net (weasel.tulip.relay.mailchannels.net [23.83.218.247]) by sourceware.org (Postfix) with ESMTPS id 8B96C3858D33 for ; Fri, 17 Feb 2023 03:49:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 8B96C3858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 80D50501221; Fri, 17 Feb 2023 03:48:57 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id EAB275013A3; Fri, 17 Feb 2023 03:48:56 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1676605737; a=rsa-sha256; cv=none; b=BS7yc1kNxjtpKzG/3T7pl3e/fNFEidRDJhd3zhtGC4F3S3t2xSgjKxraE9JSpWIKHZ09YD wF1F29fnKKgjXnHRutbI0LjbX0SZoUGHzT/ghWDz4z331k13mI+fogsGQipxAIevUUIXJH y/Uh6UGsPfDZIRtQ37O1vRJ0orUbToyp+6U7DrYoTnKxLP0vmdn24eHwSo2AqptDgdC5j5 f/f8svTSjqrdE8klV2vElJXAG+2LCFkfpiVVGzxrkChomQde6CFkM6E7PHK4dcc2iXvG8X CIq9+hW9SPrY7T5FbGLxmqJ4P7whQtIJGogQSf8YceQBXXOSZZuNWui/e+d5+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1676605737; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=6bNiYGgk9XN1vqpQn3T1dYkwSBbpa2DvNnqxvd/rJvo=; b=YLeKxrSOwDffmDnurxCyBTY6y19OBi8yU9DGiYLIOQS/gE4Qfl08Z6nxL+hy2UTOE2zVGy AT7doj6Q1WSkK42gMipv6cxjNDK5NVRI5gdhND/hZAJzD1kD8WVZ5LmrgW0MGWQKshfoWC Jh9l8BOHTf6/8x8dgLJe5lNmkzhUESqI5eFYcHxAnRGXDHwda119vNTHaggKYjsOuIPhF5 zmZ+sz5pNFU7HzjCcTOQWmfr1K88/x9tvs4e/Ds9cFMxjcCGWIscloVlC3sROTgmA2n9Er 83PEWbqdMwMJ7coiC+YXs2jehnW/NKn/rkz19aKI9f7qb/aV0iTjMal8rdawHg== ARC-Authentication-Results: i=1; rspamd-759d9dd6cd-p4kcn; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Reign-Attack: 03105f2f4797e20a_1676605737265_2950147093 X-MC-Loop-Signature: 1676605737265:2777541936 X-MC-Ingress-Time: 1676605737265 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.123.200.79 (trex/6.7.1); Fri, 17 Feb 2023 03:48:57 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-09-174-91-45-59.dsl.bell.ca [174.91.45.59]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4PHyV00JCGzRF; Thu, 16 Feb 2023 19:48:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1676605736; bh=6bNiYGgk9XN1vqpQn3T1dYkwSBbpa2DvNnqxvd/rJvo=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=HSPHZ2Z36wdkxN/s0LBhUjgqVofxRnwasge4PV65Jtg0ztHqtM70InVk0FHyfkwur ByhZotazmSeYsxvym1xTLVF9fue6/34+juC2piZkw2n7zJpQ+f1gkzl5fNXOaot4Vn q2nvnNOLa0WIRB1q/vfYb0bJB5cisYt5ROk1F0xVXqs2SSJYjT8zXYVcZmHwHDUDoq T96+wzUO05kiZF2kqcsFKmxdiVgoPE/pG1I/bFtVA7xWrXbmTugRpY5oJzxmi0S0kY BqeUEShnx8tZ6NNdEgNjsAHNHwR034g9Qhp1qUIPoMXJqnoEt+xcFC+47wKZ8yM8Lc vadGnReiUgilg== Message-ID: Date: Thu, 16 Feb 2023 22:48:54 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: Missed warning (-Wuse-after-free) Content-Language: en-US To: David Malcolm , Alejandro Colomar , GCC Cc: Iker Pedrosa References: <8ed6d28c-69dc-fed8-5ab5-99f685f06fac@gmail.com> <38e7e994a81d2a18666404dbaeb556f3508a6bd6.camel@redhat.com> From: Siddhesh Poyarekar In-Reply-To: <38e7e994a81d2a18666404dbaeb556f3508a6bd6.camel@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3030.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-02-16 10:15, David Malcolm via Gcc wrote: > I'm not convinced that it's useful to the end-user to warn about the > "use of q itself" case. FWIW, -Wuse-after-free=3 already should do this: At level 3, the warning also diagnoses uses of indeterminate pointers in equality expressions. All uses of indeterminate pointers are undefined but equality tests sometimes appear after calls to "realloc" as an attempt to determine whether the call resulted in relocating the object to a different address. They are diagnosed at a separate level to aid legacy code gradually transition to safe alternatives. For example, the equality test in the function below is diagnosed at this level: Jakub and I had discussed this in the context of _FORTIFY_SOURCE=3 (which is anal about this and can break things) and we got pr#105217, but that is also a best-effort thing, not really a guarantee. IMO the analyzer should go that extra mile and warn for the use of q itself and maybe deprecate -Wuse-after-free=3 in its favour. Sid