From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 8A779385C41C for ; Fri, 23 Jul 2021 17:37:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8A779385C41C Received: by mail-pl1-x62f.google.com with SMTP id k1so3797787plt.12 for ; Fri, 23 Jul 2021 10:37:00 -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:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=5zcyAVuXjcTESed4t3h4w2gEKIrsxnOSJdFYCtp4d4o=; b=uZH24pF43M6h6HJqd1poz4X8ya+JNHWTM3GZpjBL+CbrsQ/Q3ceDgHN+omywNUinEm UWLnuG+1cwv917xuu2PR+XgW8maeFdjv9AAFmS8wym4pILLxONyQKzQDjxD5yLJmjt5b dwEsaO6c4ZzjcQMH7TQJDYf5V/WVe2MnndW2GXSaH5ciKPLHt5tcYitIKxdiLYxanrnH nSnxXy/FdGRzBqtWW0LPjMxgmhkebc71ZwNCl5JufslbxI9AGBtCdIA4TPhpiUkwdjkU AHFMIIub4NBs3Awfc955NWrJzNr+BRCW9NGH9KbY10Tr4NEB/PUzaTg7PBj2Rc1MQqri WHCQ== X-Gm-Message-State: AOAM530Ug6orPfVPrsQGYRgpQPIsUnC89qVlXEZEO6yI8czb1e0HL6+u 1ikD2FrDvgwvv5JFGEXsvcg= X-Google-Smtp-Source: ABdhPJyrtiDWNQgVlF1/3GHfRNJ6b4eP1EeSkBDdpOt0qMJoeLXmyQcgp0Qo/GAtAVIQ7P1ttqvCfg== X-Received: by 2002:a63:d44f:: with SMTP id i15mr5929444pgj.391.1627061819553; Fri, 23 Jul 2021 10:36:59 -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 r128sm6613843pfc.155.2021.07.23.10.36.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Jul 2021 10:36:59 -0700 (PDT) Subject: Re: [PATCH] tree-optimization/101573 - improve uninit warning at -O0 To: Richard Biener , gcc-patches@gcc.gnu.org Cc: msebor@redhat.com References: <3on3509q-309q-8562-r54n-qr20o3ns1p5q@fhfr.qr> From: Jeff Law Message-ID: <58095323-cc9f-a9fa-694b-70061acba908@gmail.com> Date: Fri, 23 Jul 2021 11:36:56 -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: <3on3509q-309q-8562-r54n-qr20o3ns1p5q@fhfr.qr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_NUMSUBJECT, 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: Fri, 23 Jul 2021 17:37:01 -0000 On 7/22/2021 6:34 AM, Richard Biener wrote: > We can improve uninit warnings from the early pass by looking > at PHI arguments on fallthru edges that are uninitialized and > have uses that are before a possible loop exit. This catches > some cases earlier that we'd only warn in a more confusing > way after early inlining as seen by testcase adjustments. > > It introduces > > FAIL: gcc.dg/uninit-23.c (test for excess errors) > > where we additionally warn > > gcc.dg/uninit-23.c:21:13: warning: 't4' is used uninitialized [-Wuninitialized] > > which I think is OK even if it's not obvious that the new > warning is an improvement when you look at the obvious source. > > Somehow for all cases I never get the `'foo' was declared here` > notes, I didn't dig why that happens but it's odd. > > Bootstrapped and tested on x86_64-unknown-linux-gnu. > > Any comments? > > Thanks, > Richard. > > 2021-07-22 Richard Biener > > PR tree-optimization/101573 > * tree-ssa-uninit.c (warn_uninitialized_vars): Look at > uninitialized PHI arg defs in some constrained cases. > (execute_early_warn_uninitialized): Calculate dominators. > > * gcc.dg/uninit-pr101573.c: New testcase. > * gcc.dg/uninit-15-O0.c: Adjust. > * gcc.dg/uninit-15.c: Likewise. > * gcc.dg/uninit-23.c: Likewise. > * c-c++-common/uninit-17.c: Likewise. OK.  Like Martin I think the new code in a function would be easier to read.  So if you could factor the bits into a new function it'd be appreciated. I wouldn't be terribly surprised if we find additional fallout on other targets, but we can fault in those fixes. Jeff