From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id AB4BC393D022; Mon, 16 Nov 2020 07:48:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org AB4BC393D022 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 92C60AC2E; Mon, 16 Nov 2020 07:48:30 +0000 (UTC) Date: Mon, 16 Nov 2020 08:48:30 +0100 (CET) From: Richard Biener Sender: rguenther@c653.arch.suse.de To: Jan Hubicka cc: Andreas Schwab , gcc@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: Re: Detect EAF flags in ipa-modref In-Reply-To: <20201115180710.GA86620@kam.mff.cuni.cz> Message-ID: References: <20201110125418.GB53229@kam.mff.cuni.cz> <20201110143143.GA91644@kam.mff.cuni.cz> <87361ahph7.fsf@linux-m68k.org> <20201115111254.GB45304@kam.mff.cuni.cz> <20201115123307.GC45304@kam.mff.cuni.cz> <20201115130351.GD45304@kam.mff.cuni.cz> <87k0umvbo2.fsf@igel.home> <20201115180710.GA86620@kam.mff.cuni.cz> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Nov 2020 07:48:32 -0000 On Sun, 15 Nov 2020, Jan Hubicka wrote: > > See PR97840. > Thanks, > this is a false positive where we fail to discover that pointed-to type > is empty on non-x86_64 targets. This is triggered by better alias > analysis caused by non-escape discovery. > > While this is not a full fix (I hope someone with more experience on > C++ types and warnings will set up) I think it may be useful to avoid > warning on unused parameter. > > Bootstrapped/regtested x86_64-linux, OK? OK. > PR middle-end/97840 > * tree-ssa-uninit.c (maybe_warn_pass_by_reference): Update prototype; > silence warning on EAF_UNUSED parameters. > (warn_uninitialized_vars): Update. > diff --git a/gcc/tree-ssa-uninit.c b/gcc/tree-ssa-uninit.c > index f23514395e0..1e074793b02 100644 > --- a/gcc/tree-ssa-uninit.c > +++ b/gcc/tree-ssa-uninit.c > @@ -443,7 +443,7 @@ maybe_warn_operand (ao_ref &ref, gimple *stmt, tree lhs, tree rhs, > access implying read access to those objects. */ > > static void > -maybe_warn_pass_by_reference (gimple *stmt, wlimits &wlims) > +maybe_warn_pass_by_reference (gcall *stmt, wlimits &wlims) > { > if (!wlims.wmaybe_uninit) > return; > @@ -501,6 +501,10 @@ maybe_warn_pass_by_reference (gimple *stmt, wlimits &wlims) > && !TYPE_READONLY (TREE_TYPE (argtype))) > continue; > > + /* Ignore args we are not going to read from. */ > + if (gimple_call_arg_flags (stmt, argno - 1) & EAF_UNUSED) > + continue; > + > if (save_always_executed && access->mode == access_read_only) > /* Attribute read_only arguments imply read access. */ > wlims.always_executed = true; > @@ -639,8 +643,8 @@ warn_uninitialized_vars (bool wmaybe_uninit) > if (gimple_vdef (stmt)) > wlims.vdef_cnt++; > > - if (is_gimple_call (stmt)) > - maybe_warn_pass_by_reference (stmt, wlims); > + if (gcall *call = dyn_cast (stmt)) > + maybe_warn_pass_by_reference (call, wlims); > else if (gimple_assign_load_p (stmt) > && gimple_has_location (stmt)) > { > -- Richard Biener SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg, Germany; GF: Felix Imend