From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by sourceware.org (Postfix) with ESMTPS id 004AF39B1C47 for ; Fri, 23 Jul 2021 16:39:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 004AF39B1C47 Received: by mail-pl1-x635.google.com with SMTP id u8so3923551plr.1 for ; Fri, 23 Jul 2021 09:39:17 -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; bh=jumCVAa+qGNueoPn+wmPYvudZL9pFrCs3Mj/snVWOhQ=; b=tCpAbCK5C7QqgVIz5Z8g1QNhTe8dub17EDfpA7b522byf3Exq1J2fBiywQBWVP87Xz kS8OI8Rzre7oCvHd4TctId6+qWlQCXc4ukrv8So3uEOAh9KvAAYfqvbDRAZAoHLI5Zin HfTtd2sPgdQvceUEm+SSZ7y5aAex7dGALO26FuloXEfVd4P2jzoKMo7Kju0FF4bYk4QK XexuQzIE85IK5spDeky+Kz7UuCiS746REB5V7abmHfhPZ7z9SdVZ/qSmOiajahF4b+GZ zOX5YDMVAAKlA8gfYDBd0A6woV6ggPc93qX1RBMq1lhA8kvINTHaVZlQGly9wTTd8aEG W6Ow== X-Gm-Message-State: AOAM530ZVlnZLEbp5f9fNIL5BBeOf5PFnHCsJSvai414CzlvqFYNyObx h+GxSO1nlyyOC5QHOwkGF+RCyg7k9kFRAQ== X-Google-Smtp-Source: ABdhPJw9sQDnW7CdBBUNht27KjducnR9/lG4CoxO2tR7ygfmd79aQJwo4RIhEzzW9OIs1Edv6p1zDQ== X-Received: by 2002:a17:90a:7389:: with SMTP id j9mr7299281pjg.27.1627058356824; Fri, 23 Jul 2021 09:39:16 -0700 (PDT) Received: from [192.168.1.17] (c-98-202-48-222.hsd1.ut.comcast.net. [98.202.48.222]) by smtp.gmail.com with ESMTPSA id w186sm35498931pfw.106.2021.07.23.09.39.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Jul 2021 09:39:16 -0700 (PDT) Subject: Re: [PATCH] correct uninitialized object offset and size computation [PR101494] To: Martin Sebor , gcc-patches References: <596aa986-8619-ae8e-8fe8-7c3bfc6e08ec@gmail.com> From: Jeff Law Message-ID: <40bca91d-bf71-74c7-0209-5322c45a5278@gmail.com> Date: Fri, 23 Jul 2021 10:39:13 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <596aa986-8619-ae8e-8fe8-7c3bfc6e08ec@gmail.com> Content-Language: en-US X-Spam-Status: No, score=-2.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, 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 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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: Fri, 23 Jul 2021 16:39:19 -0000 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. jeff