From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 88449385772C for ; Sat, 15 Apr 2023 01:54:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 88449385772C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1681523652; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lU4qeY+x5gO540p4Y/HEQufljNwvMi1N9/5nrWPllhg=; b=LM+1miSM72xQsxV+NrwkvUIM3+OJGKABjdWZ5HBmwZsylHoEK8MMw33s9yG0+GQQdzAo2g xbo4FZwTjqt7D92Z/LbqFX+0nVQvO1Hv3J/6LkzWcu7CR/tzNDlirl8FUfRGJTui5oNge3 TEyWcN838qn8AwAgCNR2jJvEYwo/t24= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-171-R14GfMB4NzaWWjds0IT2dw-1; Fri, 14 Apr 2023 21:54:10 -0400 X-MC-Unique: R14GfMB4NzaWWjds0IT2dw-1 Received: by mail-qv1-f70.google.com with SMTP id f7-20020a0cc307000000b005ef445290fdso4000319qvi.9 for ; Fri, 14 Apr 2023 18:54:10 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681523650; x=1684115650; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lU4qeY+x5gO540p4Y/HEQufljNwvMi1N9/5nrWPllhg=; b=O6ROE/lGN4aU0fyFRbZI2d4CVK9OlLDiUsPcGprabNeMik/KOywnhqiggZ2EeBm2M7 4tDoukdJ10o91TxvzqMzLQ8ajOtdJ6wGyzrTE2e7pSAaJYd5yELzSopol9wm/ReymMVg lV6xC7IHOq3HmfEprPdsJh1Jc0ja+GfDjBB4jqlb9T7hemAKRZFs5GHzvwQb5Jhenk1W 2YUNXpth//wL98x4TLEcHXpmWgZr3pujO7Q714ZxSup8XZXSdFg5Tgdu9fq8lzziOv2L 6/CuWUmKFjvjJPE/PDEFvo/iAV/6PZVU1xvV2Qt0jUroaHKE3uUr75FlASoXPkHvkdG9 gMTw== X-Gm-Message-State: AAQBX9ctu9bxbldOAXurrrQ5VDZWMMSDcaZrhu7GTngHQJUsAgfLDNtH d61XrfqwZHxI0q3WoX6ApvGI6U3HhzC6nQ/dZ4WDStM3jXR2BMrwEgLDu667aR0W/M0r2AMrEf7 0SKVTkDd2A9VIWiRdtw== X-Received: by 2002:a05:622a:178d:b0:3e6:720f:bad7 with SMTP id s13-20020a05622a178d00b003e6720fbad7mr10749715qtk.54.1681523650240; Fri, 14 Apr 2023 18:54:10 -0700 (PDT) X-Google-Smtp-Source: AKy350bCQ07Hbhr4jENbvgg0ePsSXJ7PsMc5MbEztflhC/7CwHUt4QIrPuxVWS8XPOlUJg8XvZj5UA== X-Received: by 2002:a05:622a:178d:b0:3e6:720f:bad7 with SMTP id s13-20020a05622a178d00b003e6720fbad7mr10749710qtk.54.1681523649935; Fri, 14 Apr 2023 18:54:09 -0700 (PDT) Received: from [10.0.0.48] ([66.31.49.15]) by smtp.gmail.com with ESMTPSA id r11-20020ac87eeb000000b003e38e2815a5sm1615560qtc.22.2023.04.14.18.54.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Apr 2023 18:54:09 -0700 (PDT) Message-ID: Date: Fri, 14 Apr 2023 21:54:08 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH RFA] -Wdangling-pointer: fix MEM_REF handling [PR109514] To: Jeff Law , gcc-patches@gcc.gnu.org References: <20230414234224.2870389-1-jason@redhat.com> <032ca48b-6e8c-f469-ab28-37933ea0ecf5@gmail.com> From: Jason Merrill In-Reply-To: <032ca48b-6e8c-f469-ab28-37933ea0ecf5@gmail.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.2 required=5.0 tests=BAYES_00,BODY_8BITS,DKIMWL_WL_HIGH,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_NONE,TXREP,T_SCC_BODY_TEXT_LINE 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 4/14/23 21:22, Jeff Law wrote: > > > On 4/14/23 17:42, Jason Merrill via Gcc-patches wrote: >> Tested x86_64-pc-linux-gnu, ok for trunk? >> >> -- 8< -- >> >> Here we hit the MEM_REF case, with its arg an ADDR_EXPR, but had no >> handling >> for that and wrongly assumed it would be a reference to a local variable. >> This patch overhauls the logic for deciding whether the target is >> something >> to warn about so that we only warn if we specifically recognize the >> target >> as non-local.  None of the existing tests regress as a result. >> >>     PR c++/109514 >> >> gcc/ChangeLog: >> >>     * gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores): >>     Overhaul lhs_ref.ref analysis. >> >> gcc/testsuite/ChangeLog: >> >>     * g++.dg/warn/Wdangling-pointer-6.C: New test. > One might ask if we have a (MEM_REF (ADDR_REF ...)) why we didn't > simplify that by removing the MEM_REF and ADDR_REF wrappers. FYI in this case the type of the MEM_REF is the type of a member of a member of a member of the variable. > But on > the assumption there's a good reason to have such nodes, OK for the trunk. > > jeff >