From patchwork Fri Feb 4 13:49:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1588416 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.a=rsa-sha256 header.s=default header.b=PUd2J+MH; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4JqxmJ4GJMz9s9c for ; Sat, 5 Feb 2022 00:52:00 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3B2163858C2C for ; Fri, 4 Feb 2022 13:51:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3B2163858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1643982718; bh=2nCqZ3jqmLon9/7a2Lt6YV6SJ+WM9EQmfBrUs7m+hPU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=PUd2J+MHyjvHfxUg4m4v3uLUK9c9D3ciywQumg9WH36rLfEd+Ua/vR+dFZXCmmSOe LMgjVDJUT3i54Pir/Hcz+gYF+nNVF2fqR2EfYpBr+7Pgr3gubilNb5TDpphM9uwBjv AwwxbHvnBO/6yeXwJlE4TRPecNGMFCNes23Oocec= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 160AF3858D35 for ; Fri, 4 Feb 2022 13:49:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 160AF3858D35 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id E7F48210F8 for ; Fri, 4 Feb 2022 13:49:26 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D470013A96 for ; Fri, 4 Feb 2022 13:49:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id +uqsMuYu/WHFegAAMHmgww (envelope-from ) for ; Fri, 04 Feb 2022 13:49:26 +0000 Date: Fri, 4 Feb 2022 14:49:26 +0100 (CET) To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/4] Diagnostic passes adjustments MIME-Version: 1.0 Message-Id: <20220204134926.D470013A96@imap2.suse-dmz.suse.de> X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE 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-Patchwork-Original-From: Richard Biener via Gcc-patches From: Richard Biener Reply-To: Richard Biener Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org Sender: "Gcc-patches" This adjusts diagnostic passes for the birth CLOBBERs where necessary. In particular the uninit diagnostics relies on particular shaped IL to simplify the expression printed (to be cleaned up independently) in gcc.dg/pr86058.c. 2022-02-02 Richard Biener * tree-ssa-uninit.cc (check_defs_data::found_full_clobber): New member. (check_defs): Set it. (maybe_warn_operand): Use it to treat expression simplification the same way as when the function entry was reached. --- gcc/tree-ssa-uninit.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/tree-ssa-uninit.cc b/gcc/tree-ssa-uninit.cc index 02e88d58e1f..f2b15439113 100644 --- a/gcc/tree-ssa-uninit.cc +++ b/gcc/tree-ssa-uninit.cc @@ -319,6 +319,8 @@ struct check_defs_data { /* If we found any may-defs besides must-def clobbers. */ bool found_may_defs; + /* If we found a GIMPLE clobber that made the whole ref undefined. */ + bool found_full_clobber; }; /* Return true if STMT is a call to built-in function all of whose @@ -501,7 +503,10 @@ check_defs (ao_ref *ref, tree vdef, void *data_) if (gimple_clobber_p (def_stmt)) { if (stmt_kills_ref_p (def_stmt, ref)) - return true; + { + data->found_full_clobber = true; + return true; + } return false; } @@ -601,6 +606,7 @@ maybe_warn_operand (ao_ref &ref, gimple *stmt, tree lhs, tree rhs, check_defs_data data; bool fentry_reached = false; data.found_may_defs = false; + data.found_full_clobber = false; tree use = gimple_vuse (stmt); if (!use) return NULL_TREE; @@ -666,7 +672,10 @@ maybe_warn_operand (ao_ref &ref, gimple *stmt, tree lhs, tree rhs, if (tree ba = get_base_address (base)) base = ba; } + } + if (fentry_reached || data.found_full_clobber) + { /* Replace the RHS expression with BASE so that it refers to it in the diagnostic (instead of to ''). */