From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by sourceware.org (Postfix) with ESMTPS id 41F8F383A831 for ; Tue, 6 Jul 2021 15:46:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 41F8F383A831 Received: by mail-ot1-x331.google.com with SMTP id 59-20020a9d0ac10000b0290462f0ab0800so21960904otq.11 for ; Tue, 06 Jul 2021 08:46:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; 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=F8T61qKf04/7ayKY1qQ7/u8gRx5xOlTLUYECCkhxQkA=; b=A5lmorrPeIXX0Yq7ZFwn+bNnsSf7iDXMLtg/B8d3cYPHr+efr+2gxvmPj8Z+2BO5Q/ 8tKyODmOEbVxj0Fqlhc5bI8x9DvN8aQf6xBcVvRTH6+wv2cWbRzEMB1Y8YRGM63i9jak kkO3sCNnXuGBKjueQg7qesL1xln6yxceC5TKQFrrZGOB64wPTi7gHVQWeCpDbI2/NZtn OEoyHiyZ3gIzjGFsOnmU2yTW2fKRkGxngLSpKT71rVRlMTY1ZHAQyNQVKKTURCGtirt3 /AGgQ9DBcs/tUJZjrL6S+1WMsgfMJPjO2CXTNxWRwiHYaaF3BZ1vOzv5sc4C8t7qDK94 lm3g== X-Gm-Message-State: AOAM531gk6YoFLMG5Ze/I+2iPUqt/p48LNDUcAdg6G0mvEfMJL7GFGTi dlqJrGn3swK2SyByUCe6R+/YshdHZ9w= X-Google-Smtp-Source: ABdhPJzdoCQTiSyaerElj1RGNNI/ukQSieFdMXuT/2aPiHBxbFe9+roVxYtNY1ZoK1s0lAVhAo//BA== X-Received: by 2002:a9d:5d01:: with SMTP id b1mr14964234oti.158.1625586389492; Tue, 06 Jul 2021 08:46:29 -0700 (PDT) Received: from [192.168.0.41] (75-166-102-22.hlrn.qwest.net. [75.166.102.22]) by smtp.gmail.com with ESMTPSA id t21sm148608otl.29.2021.07.06.08.46.28 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 06 Jul 2021 08:46:29 -0700 (PDT) Subject: PING 2 [PATCH] correct handling of variable offset minus constant in -Warray-bounds (PR 100137) From: Martin Sebor To: gcc-patches References: Message-ID: <63b26859-944b-cfbf-64a3-e70c73c09727@gmail.com> Date: Tue, 6 Jul 2021 09:46:28 -0600 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: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit 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, 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: Tue, 06 Jul 2021 15:46:31 -0000 Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573349.html On 6/28/21 1:33 PM, Martin Sebor wrote: > Ping: https://gcc.gnu.org/pipermail/gcc-patches/2021-June/573349.html > > On 6/21/21 4:25 PM, Martin Sebor wrote: >> -Warray-bounds relies on similar logic as -Wstringop-overflow et al., >> but using its own algorithm, including its own bugs such as PR 100137. >> The attached patch takes the first step toward unifying the logic >> between the warnings.  It changes a subset of -Warray-bounds to call >> compute_objsize() to detect out-of-bounds indices.  Besides fixing >> the bug this also nicely simplifies the code and improves >> the consistency between the informational messages printed by both >> classes of warnings. >> >> The changes to the test suite are extensive mainly because of >> the different format of the diagnostics resulting from slightly >> tighter bounds of offsets computed by the new algorithm, and in >> smaller part because the change lets -Warray-bounds diagnose some >> problems it previously missed due to the limitations of its own >> solution. >> >> The false positive reported in PR 100137 is a 10/11/12 regression >> but this change is too intrusive to backport.  I have a smaller >> and more targeted patch I plan to backport in its stead. >> >> Tested on x86_64-linux. >> >> Martin >