From patchwork Tue Sep 6 09:28:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1037 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp544322wrt; Tue, 6 Sep 2022 02:29:37 -0700 (PDT) X-Google-Smtp-Source: AA6agR4f5gVBaY2eU3tDgYP+CJO5qDBvKfP16jKWlcMqiftRFF2YYqVciBtVs/ahXVkMn+XwleT9 X-Received: by 2002:a05:6402:17c7:b0:44e:8bd8:73ca with SMTP id s7-20020a05640217c700b0044e8bd873camr7113232edy.141.1662456577714; Tue, 06 Sep 2022 02:29:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662456577; cv=none; d=google.com; s=arc-20160816; b=eykNoKSYzYoYIvRFHLInmpEroZhciIqIuIhHQxFocXTwOfWM3h2VNqQIA5lM3fHmiC Hsl8CpKbsg2ifR6pffBRazXsVvZB/WKLostLE4STLiUufSvNMsgYks2j/2bzS1V/QQEy 6RzVK8bIzkJiEEcBFHKSJr9AEcEIBYqtJTtfw0jIg7uLTA7IudskLlxV/8+Dhqr4DGo+ //R4lXgYiKxIVrMcqtrAYgYbJMqhV73q8gjK9sfOgTgWHNsGMUasIob25EppbbE3hHDa x5HmNTxuGbyVxBdwf2hICGlldDF7KsP4Gp6QAbWS2FCo9mnPE+Zs9WH5AmGpE3rl+92P JD9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:sender:errors-to:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mime-version:user-agent:subject:to:date:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=mn1ira7oD7/iwAbsv7RDPGilSF1Q3CxW7aSXERvDBGM=; b=StcRQZbPKUnfHOOThkmui8POTaKgsx4pfi7tMK1Q6g/qNk3clAYPqdwa/4FD7lC04D D+RzdBlg9Jy3uG/9g9OX7nLmbwiCKNjhGzoSnnW8wLvW77MlF/fDwk3F3KBiyYRYLs25 oFwKXmLBXxjp751wC8id6Yln0mIMM/zYISzZHPLhXGkvPauPBCHf5z6yg8gX5aj2ck82 Ve5ekS35ASdOffohtViI30TtivE5PN89eYn/AjblACTCqD2pGRJm6N3N2F6zPMt/FbBu EBoPUvhIJypBzV2SskjfKJHqr6GNPFsnJx6JO7pRBFJAFkHFZrH2WCzQD9+8uD0HPZAD wNLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=vMJuUvS9; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id q6-20020a056402518600b004483b772d31si10973644edd.230.2022.09.06.02.29.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Sep 2022 02:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=vMJuUvS9; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id ABE0E38515C3 for ; Tue, 6 Sep 2022 09:29:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org ABE0E38515C3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662456576; bh=mn1ira7oD7/iwAbsv7RDPGilSF1Q3CxW7aSXERvDBGM=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=vMJuUvS9SWBfrErJsYMVt0ZvVpZqPKSTysRmxt3Nac45doPnUKlOf1qtItU7aLFYS Nr4jMJsmKS1Rnz/bl7ERsqZF2/p9qUk98pv9f/hdNawvpKg+KvVfpU9X/MYnKRN552 6/GT3Pv21QNo4et6U1BvfxiiHpiyd/MELFWAdXYI= 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 [IPv6:2001:67c:2178:6::1c]) by sourceware.org (Postfix) with ESMTPS id 9CC4C385142A for ; Tue, 6 Sep 2022 09:28:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9CC4C385142A Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id AA3B7339C4 for ; Tue, 6 Sep 2022 09:28:47 +0000 (UTC) Received: from wotan.suse.de (wotan.suse.de [10.160.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id A573E2C141 for ; Tue, 6 Sep 2022 09:28:47 +0000 (UTC) Date: Tue, 6 Sep 2022 09:28:47 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] tree-optimization/106844 - fix ICE in init_use_preds User-Agent: Alpine 2.22 (LSU 394 2020-01-19) MIME-Version: 1.0 X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" Message-Id: <20220906092936.ABE0E38515C3@sourceware.org> X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1743212068503896211?= X-GMAIL-MSGID: =?utf-8?q?1743212068503896211?= The following fixes an oversight in the last change to compute_control_dep_chain where we have to return whether we found a chain. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. PR tree-optimization/106844 * gimple-predicate-analysis.cc (compute_control_dep_chain): Return whether we found a chain. * gcc.dg/pr106844.c: New testcase. --- gcc/gimple-predicate-analysis.cc | 2 +- gcc/testsuite/gcc.dg/pr106844.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr106844.c diff --git a/gcc/gimple-predicate-analysis.cc b/gcc/gimple-predicate-analysis.cc index 681047deee7..ef2906ebc51 100644 --- a/gcc/gimple-predicate-analysis.cc +++ b/gcc/gimple-predicate-analysis.cc @@ -1077,7 +1077,7 @@ compute_control_dep_chain (basic_block dom_bb, const_basic_block dep_bb, if (dump_file) fprintf (dump_file, "param_uninit_control_dep_attempts " "exceeded: %u\n", *num_calls); - return false; + break; } ++*num_calls; diff --git a/gcc/testsuite/gcc.dg/pr106844.c b/gcc/testsuite/gcc.dg/pr106844.c new file mode 100644 index 00000000000..df68d76f257 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr106844.c @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O -Wuninitialized --param uninit-control-dep-attempts=1" } */ + +struct { + int count; + int array[8]; +} fde_merge_v1; + +void +fde_merge_i2() { + unsigned i1; + do + while (i1 && fde_merge_v1.array[i1 - 1]) /* { dg-warning "uninitialized" } */ + i1--; + while (fde_merge_i2); +}