From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by sourceware.org (Postfix) with ESMTPS id AC4AD3858C78 for ; Fri, 17 Feb 2023 11:23:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AC4AD3858C78 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-x430.google.com with SMTP id bw20so834856wrb.12 for ; Fri, 17 Feb 2023 03:23:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=cgAafn32XxiNtJC1FBKf3s1W0B/QInYmYRVlb2RcsqE=; b=ZQkyrGxHoRjEjEriwS+wqNYLJg+ARhM1GquBU29pAo2UrIGNUXBJQ+SmXTGBUDn0ZR CZhJlDfh9JcITGNCaxEbLek66tGSXlkcsRBWMq8oeZJKuiU66SC8Yk4oZKzaUwrRl5UX j0OWaCQyt/Z/Nde20jFwHF0uvQ+WTPXFUk1jvghBL8SPQdUJW74FHb47o6gxVzvnY3uH Oh8zl2uQ8ET5iJ8GKBXpjJ65JchFIdGeeC5TfnS+9Sj8phWZCbU5shlNKBiWt8i9lUZl pfcTxc0q7gciothLcnjR/fbSWBngcLBN8f0ACQJqQMFDyEaPQPBfKjBuol98yy4VZf2d sSBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:content-language:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=cgAafn32XxiNtJC1FBKf3s1W0B/QInYmYRVlb2RcsqE=; b=RZUdz6E3J2BCesgSNMRJcabF4chCvpMsjpCGTqEXyzuoVU1Isa3LOrGfwce0K3Xrsn P+NTy9fkMpLyIMfQ7KQQGOKchPKihtlX5DI9fglMGAzPVqtUS/sGXgA/wMXSG4zOqs3F UZr51zFcTKSNbQdPRBDiCtudyMXPIumv+MW1sxu0EPxL+2Er67cPRDwRq2AKfNpA+5HD 8xOtahoUNF853OjZp6BFzkLR+IlAs7cUSFeIqMZXTcFRQ9AIPTcwdQGkAAjkecnoMMgj 4s1VzQzL3A4pTdDc8s7PNv7o/geadmkaJ3oEDpXm+XkkZQmRaqjDvX88/NLssPh6bYrb 2r5A== X-Gm-Message-State: AO0yUKWX/A/DVWO7KgDnh9t7RaxpWgxTQXPCauKUrph3nGq+djx4RvWL Kg4QFtRZUhs2QQVGL2UHV/g= X-Google-Smtp-Source: AK7set95G/hjbk8+csbhSygn87FXZOSvZwg5hymxg6S+zb8dhx4M4LMnW9cgTsntf+ajb3kqHJVapw== X-Received: by 2002:a05:6000:120e:b0:2c5:63df:1171 with SMTP id e14-20020a056000120e00b002c563df1171mr8327240wrx.19.1676632982016; Fri, 17 Feb 2023 03:23:02 -0800 (PST) Received: from [192.168.0.160] ([170.253.36.171]) by smtp.gmail.com with ESMTPSA id b16-20020adfee90000000b002c592535839sm3374406wro.17.2023.02.17.03.23.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 17 Feb 2023 03:23:01 -0800 (PST) Message-ID: Date: Fri, 17 Feb 2023 12:22:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: Missed warning (-Wuse-after-free) To: Siddhesh Poyarekar , GCC Cc: Iker Pedrosa , David Malcolm , Florian Weimer , Sam James , Paul Eggert , Michael Kerrisk , Martin Uecker , =?UTF-8?B?SuKCkeKCmeKCmyBHdXN0ZWR0?= , Yann Droneaud References: <8ed6d28c-69dc-fed8-5ab5-99f685f06fac@gmail.com> <38e7e994a81d2a18666404dbaeb556f3508a6bd6.camel@redhat.com> Content-Language: en-US From: Alejandro Colomar In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="------------0MVpY0SRrcsuCVD3g3RwoSdx" X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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: This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --------------0MVpY0SRrcsuCVD3g3RwoSdx Content-Type: multipart/mixed; boundary="------------MbYEjAZSRh8IWUHvgD45nKMk"; protected-headers="v1" From: Alejandro Colomar To: Siddhesh Poyarekar , GCC Cc: Iker Pedrosa , David Malcolm , Florian Weimer , Sam James , Paul Eggert , Michael Kerrisk , Martin Uecker , =?UTF-8?B?SuKCkeKCmeKCmyBHdXN0ZWR0?= , Yann Droneaud Message-ID: Subject: Re: Missed warning (-Wuse-after-free) References: <8ed6d28c-69dc-fed8-5ab5-99f685f06fac@gmail.com> <38e7e994a81d2a18666404dbaeb556f3508a6bd6.camel@redhat.com> In-Reply-To: --------------MbYEjAZSRh8IWUHvgD45nKMk Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Siddhesh, On 2/17/23 04:48, Siddhesh Poyarekar wrote: > 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. >=20 > FWIW, -Wuse-after-free=3D3 already should do this: Thanks! It works. I would have expected such a warning to be included in -Wextra. Does it have any false positives (or maybe too many false negatives?) that make it unsuitable for -Wextra? >=20 > At level 3, the warning also diagnoses uses of indeterminate pointers i= n=20 > equality expressions. All uses of indeterminate pointers are undefined= =20 > but equality tests sometimes appear after > calls to "realloc" as an attempt to determine whether the call resulted= =20 > in relocating the object to a different address. They are diagnosed at= =20 > a separate level to aid legacy code gradually > transition to safe alternatives. For example, the equality test in the= =20 > function below is diagnosed at this level: >=20 > Jakub and I had discussed this in the context of _FORTIFY_SOURCE=3D3=20 > (which is anal about this and can break things) and we got pr#105217,=20 > but that is also a best-effort thing, not really a guarantee. >=20 > IMO the analyzer should go that extra mile and warn for the use of q=20 > itself and maybe deprecate -Wuse-after-free=3D3 in its favour. >=20 > Sid Cheers, Alex --=20 GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5 --------------MbYEjAZSRh8IWUHvgD45nKMk-- --------------0MVpY0SRrcsuCVD3g3RwoSdx Content-Type: application/pgp-signature; name="OpenPGP_signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="OpenPGP_signature" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE6jqH8KTroDDkXfJAnowa+77/2zIFAmPvY40ACgkQnowa+77/ 2zIaJw//Vwrd9qXzm9IBRj3m7HvurYfgM6XJ+UhZ8QnDLMAZ/87nWHEarw7J29fD 4v1t+OJbvamH4NNIGoT3943Bf30vMI5H9nmS+I9dDcvr4wSBmhD39HvWDk1fCRuD fj1CQuehCu8nx63tGHkfGRT/D/pPg/ImHzr2PWZmR9GR4dJ2CaDDPPGt49jN42nE KzHTkexe875EH6LOXGFahT1s0GvglrX0xdRKuKMZ6ir63gWtuECz7oaKKUHRNmgz xvGh6tYFrqBW0qq+2saV0Vy3rfKRLGtZxt92Noe+XwqfXMdZBial1OxkLYJio8Vd SieYA4yZQmqZK0EZYlOj2AYdbgYKDS66zwtuClncaGayZPfNJQ0YZNX8oISaoJQD xDsX2aeJ5wJPdo7g8Ur0Ejq2AMG/dWs4FlAHmNY2zy2QtAuqp0EbsDSB6oknQHGy b0FtZGMiskaMXVGRq3Pp2iSmG7Kq75Y1mA30ajoc7CV+h7cw786loLYfzc1TI1w9 agTCqZGOlIntrnDEoMOnBDJE4+HBEgmXNaNc6hWK38GEqfLGa6dGOuVhn9p33I4b ttUXyychlWLv1wQ1t0SZcGmVw1887cAY7Vnwu/vZUZ9sat1BUOkzdkKjSskufJEG /unRf3mPa8C/LSB5PHZsTAufFqvhUkpZsSEHU3FjSPX4QSO5jgM= =7GsG -----END PGP SIGNATURE----- --------------0MVpY0SRrcsuCVD3g3RwoSdx--