From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x336.google.com (mail-ot1-x336.google.com [IPv6:2607:f8b0:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 0FA58385841C for ; Mon, 29 Nov 2021 16:01:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0FA58385841C Received: by mail-ot1-x336.google.com with SMTP id x19-20020a9d7053000000b0055c8b39420bso26159002otj.1 for ; Mon, 29 Nov 2021 08:01:48 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=5DuCjsCYUF0xBg7wB+vWzToTrLSCty6dpBmWcz3XHkY=; b=GjQ/h8pWohpLudGDeSyXkot66NrhGYRsWOD9iKhe2v98bkV344GsuBpSMokcXwBHgF gFBedcFcd+hYtyDtlvVPKfK3IBLs+kESP5uyrh1LzFILvvBdg1qR5AKxwJgCBT1sx+GB rNOWNEQSLXHRaLS+qyjLq6viSN5Rs9M6sXdJWa6MxPxVGVrFgnYj4Hq5sTvd9t+bNelL JrBJL/WIrk9WuaYgfDmHL1Fcb7jQRXNkxWHAZsxr8+lGw3bK9gmhKSiLTJrh/1lXMtiY yOfsFLTXZ2O2sbQfPlOhiCM3AEwItwzW0NbKv0zKQYZn388yfDZMlX/4wdMjeJFlxG59 zWrQ== X-Gm-Message-State: AOAM532RGj6cR1oiK4hEOYygVE1Ee5CxCsiRaYd7V6DmweE8eQDZsKxs uPzYCkWmeJT+cI8+rVF9kaM+x20RS0Q= X-Google-Smtp-Source: ABdhPJx4jsv/kgzPloeI+XbLnD+iYZC9RMfZty87+2CeysKY1XxHgTSAOxb9VSwQjYpOQljVXK3oQA== X-Received: by 2002:a05:6830:1544:: with SMTP id l4mr45364280otp.309.1638201705836; Mon, 29 Nov 2021 08:01:45 -0800 (PST) Received: from [192.168.0.41] (184-96-227-137.hlrn.qwest.net. [184.96.227.137]) by smtp.gmail.com with ESMTPSA id g9sm2713034otr.18.2021.11.29.08.01.45 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Nov 2021 08:01:45 -0800 (PST) Subject: PING [PATCH] correct handling of offsets in PHI expressions [PR103215] From: Martin Sebor To: gcc-patches References: <0a747b7c-4cff-b643-3b34-5c9e113c7523@redhat.com> Message-ID: <3f98da1b-96b7-f2aa-3ecb-be90259414f9@gmail.com> Date: Mon, 29 Nov 2021 09:01:44 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <0a747b7c-4cff-b643-3b34-5c9e113c7523@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_SHORT, 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: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 29 Nov 2021 16:01:50 -0000 Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585180.html On 11/22/21 4:54 PM, Martin Sebor wrote: > In an effort to avoid false positives while still detecting > certain out-of-bounds accesses the warning code that handles > PHI nodes chooses the operand with the most space remaining > as the one representative of the PHI.  That's not right when > the offsets into the operands are unequal, because it overly > constrains the range of offsets that can be substracted from > the pointer. > > The attached change corrects the logic here to not only use > the size of the largest operand but also to extend the range > of offsets into it to reflect all operand.  Unfortunately, > as a result of the more conservative offset computation, > the fix leads to a fair number of false negatives.  I tried > to avoid those but couldn't come up with a clean solution > that didn't require design changes, so I defer those to GCC > 13. > > The diff is relative to the "cleanup" patch submitted below: > https://gcc.gnu.org/pipermail/gcc-patches/2021-November/583735.html > > Tested on x86_64-linux and by building Glibc and confirming > no new warnings. > > Martin