From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk1-x72a.google.com (mail-qk1-x72a.google.com [IPv6:2607:f8b0:4864:20::72a]) by sourceware.org (Postfix) with ESMTPS id DDE6F38A8863 for ; Wed, 28 Jul 2021 22:28:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DDE6F38A8863 Received: by mail-qk1-x72a.google.com with SMTP id b20so3918115qkj.3 for ; Wed, 28 Jul 2021 15:28:40 -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:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=doRRl2rlq9VTNaKIaPHlu0BjSRsTQKrz7mSVNL6N534=; b=oNlqerMpofznpLWKn7nXg+LMOGf7p4ZN4APgnyRc1REoyC3SX4ddsgACSs3fqXplWH dNyp2PzOVFt4uPPJdppOzqZurQB1SA53LZOm//xa88XtbyB+VKZT8kPZ6LlagaASldiQ xwG3t/mxIfSlbvva57Kt0UlK5BzomkV5R/4eRc8yeSlM9fdtzaIYWcJdZ+SAZ4hTDIlk txPQjaJFmitixV/s0UAe1LyHhGQqaGNtdZImyUiWpB6OzLO6fUym5LSXumBXvOXq7m/D dhYBxPpeOu7Jk0WFoP9f0tXS9+N8LIKlqXDmWuxgMdAxwmzqtIJZ4NPM6bmQ+fkBlghP pskQ== X-Gm-Message-State: AOAM532WrEf/ZUCzzqrj9c+p8RvyZ9NAihTD0pUHjxU/PcPtc6vui+5c HEdtfBZDXQNkCh2aWVLP+46aX8LHOUo= X-Google-Smtp-Source: ABdhPJwp5DZ4ti1EUujldWPk1om6uDUYXo4Xad3XRTSeePnnxiYwcbJFCAz0y3W+RrTKTzaI2bAiew== X-Received: by 2002:ae9:eb97:: with SMTP id b145mr2039219qkg.111.1627511320396; Wed, 28 Jul 2021 15:28:40 -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 i24sm727202qki.61.2021.07.28.15.28.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 28 Jul 2021 15:28:40 -0700 (PDT) Subject: Re: [PATCH] correct uninitialized object offset and size computation [PR101494] To: Jeff Law , gcc-patches References: <596aa986-8619-ae8e-8fe8-7c3bfc6e08ec@gmail.com> <40bca91d-bf71-74c7-0209-5322c45a5278@gmail.com> From: Martin Sebor Message-ID: <14ea6066-7451-9f35-fa00-8305ff94fc8c@gmail.com> Date: Wed, 28 Jul 2021 16:28:38 -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: <40bca91d-bf71-74c7-0209-5322c45a5278@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 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.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: Wed, 28 Jul 2021 22:28:42 -0000 On 7/23/21 10:39 AM, Jeff Law wrote: > > > On 7/22/2021 3:58 PM, Martin Sebor via Gcc-patches wrote: >> The code that computes the size of an access to an object in >> -Wuninitialized is limited to declared objects and so doesn't >> apply to allocated objects, and doesn't correctly account for >> an offset into the object and the access size.  This causes >> false positives. >> >> The attached fix tested on x86_64-linux corrects this. >> >> Martin >> >> gcc-101494.diff >> >> Correct uninitialized object offset and size computation [PR101494]. >> >> Resolves: >> PR middle-end/101494 - -uninitialized false alarm with memrchr of size 0 >> >> gcc/ChangeLog: >> >> PR middle-end/101494 >> * tree-ssa-uninit.c (builtin_call_nomodifying_p): >> (check_defs): >> (maybe_warn_operand): >> >> gcc/testsuite/ChangeLog: >> >> PR middle-end/101494 >> * gcc.dg/uninit-38.c: >> * gcc.dg/uninit-41.c: New test. >> * gcc.dg/uninit-pr101494.c: New test. > OK once you complete the ChangeLog entry for the tree-ssa-uninit.c > change.  Note this change only modifies maybe_warn_operand. Whoops. Fixed and pushed in r12-2583. Martin