From patchwork Mon Aug 22 16:57:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Polacek X-Patchwork-Id: 653 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:ecc5:0:0:0:0:0 with SMTP id s5csp585008wro; Mon, 22 Aug 2022 09:58:40 -0700 (PDT) X-Google-Smtp-Source: AA6agR6PfZl9IB4pcFMGawVbCSHMPOlIK5WlriylwuWUwB4ckAJRzO22U069gmSmf1adGg6Z7wpd X-Received: by 2002:a05:6402:4252:b0:446:ef32:b3fd with SMTP id g18-20020a056402425200b00446ef32b3fdmr97768edb.374.1661187519941; Mon, 22 Aug 2022 09:58:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661187519; cv=none; d=google.com; s=arc-20160816; b=cNu1K43IPlr/8N/+bnXRQjM6TzUcQr+mg12u66HEzGYYGR9C+LUh78KjQl17e6WJjc YXIVT1jEsCl6uzA9CIF86uJYBVY3C7H9Cdpo9wbtcUX4SBF0TaqQE2AnIyug8C9a2t7N 77M399T+q5F0dt84hA7ZtAEWcdSPgQwb7iErVMm6h/mBLti1pPbN1wuhfkOX9E7quLQS Yj8TacpjK/U9IxOfpNfYhwNA0e2gTrYIs0bQAeDqCaXYcNdS7exgyV/kNpyEBz0y7e39 HkorpAaX0E9b47sX7uCjhvWceRF4YnqwtnceYdoJT8vq/SViSJdyWVnq/Dxz+Hb07wVD hdbw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=FSKpYbCDVWa0bzkcBhb59oQd8xF9GzOGILgPtDkxWy0=; b=wuXujdaJhPqqeloVMRGV/1Mkm9Mq2wszb2Sjlo6sGLrZ02qUe39CeW5QtdtBxSl5bs WNftoQr1Bgs5+uRkh9QmqVJdzHSHT0qhL8/t9tmrDs7dppbnm95qz15mPZTm4D28Hmte cgVJvm+ZV2qWUeStV63n5KMzuFJjJaMfUmRYCWuMtj4ZtAshoNbtGtmqqDpVN+rdCKyK tUDiKIF1nnWT9N6uSgOkvpjwInr7GKYvvGgqLU+dfviewYszHoAB32giP8EvKR1rQqUb LX8B/USOOjKnQqTOwxGUzCVPv5WWMth4sve+NRao9tYhxtumUhgmTglkOejm94sartN9 SDKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QczANCKj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id hd6-20020a170907968600b007341ad4aff3si5088032ejc.959.2022.08.22.09.58.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 09:58:39 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=QczANCKj; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c 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 48B203857C42 for ; Mon, 22 Aug 2022 16:58:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 48B203857C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1661187518; bh=FSKpYbCDVWa0bzkcBhb59oQd8xF9GzOGILgPtDkxWy0=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=QczANCKj5IYwAm6lyysEgZzgHI1sGCKKKPRkGHdACQ7weQpFyOc3CawiOOaYkvyxf K/xMGBBtk0GAjKRDmIHrIBIN8EQZXFriomrb09HDLSzibsYlhHYG9ZbShm3SzaHHO1 Gb3eUs0dZpgQnCqH4SLSTCInbYSqIlhC4Ciz1x88= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 34F643858424 for ; Mon, 22 Aug 2022 16:57:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 34F643858424 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-259-2sfMgX1DMoCokfMpuMLJCA-1; Mon, 22 Aug 2022 12:57:50 -0400 X-MC-Unique: 2sfMgX1DMoCokfMpuMLJCA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 6A4AF85A586; Mon, 22 Aug 2022 16:57:50 +0000 (UTC) Received: from pdp-11.redhat.com (unknown [10.22.17.170]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EBA22026D4C; Mon, 22 Aug 2022 16:57:50 +0000 (UTC) To: GCC Patches , Richard Biener Subject: [PATCH] testsuite: Add test for r11-4123 Date: Mon, 22 Aug 2022 12:57:37 -0400 Message-Id: <20220822165737.39118-1-polacek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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: Marek Polacek via Gcc-patches From: Marek Polacek Reply-To: Marek Polacek Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1741881364698613811?= X-GMAIL-MSGID: =?utf-8?q?1741881364698613811?= r11-4123 came without a test but I happened upon a nice test case that got fixed by that revision. So I think it'd be good to add it. The ICE was: phi-1.C: In constructor 'ElementManager::ElementManager()': phi-1.C:28:1: error: missing definition 28 | ElementManager::ElementManager() : array_(makeArray()) {} | ^~~~~~~~~~~~~~ for SSA_NAME: _12 in statement: _10 = PHI <_12(3), _11(5)> PHI argument _12 for PHI node _10 = PHI <_12(3), _11(5)> during GIMPLE pass: fixup_cfg phi-1.C:28:1: internal compiler error: verify_ssa failed Incidentally, do you think it's safe to backport r11-4123 to GCC 8 (downstream)? Thanks. Tested on x86_64-pc-linux-gnu, ok for trunk? gcc/testsuite/ChangeLog: * g++.dg/tree-ssa/phi-1.C: New test. --- gcc/testsuite/g++.dg/tree-ssa/phi-1.C | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/tree-ssa/phi-1.C base-commit: b6316324fceaef431799a8b386de5cc9881d6898 diff --git a/gcc/testsuite/g++.dg/tree-ssa/phi-1.C b/gcc/testsuite/g++.dg/tree-ssa/phi-1.C new file mode 100644 index 00000000000..26cade052e3 --- /dev/null +++ b/gcc/testsuite/g++.dg/tree-ssa/phi-1.C @@ -0,0 +1,28 @@ +// { dg-do compile { target c++11 } } +// { dg-options "-O --param early-inlining-insns=14" } + +struct Element; +template struct __array_traits { typedef Element _Type[_Nm]; }; +template struct array { + typename __array_traits<_Nm>::_Type _M_elems; +}; +bool logLevel(); +struct LogCapture { + void stream(); +}; +struct Element { + Element(); + long data_; +}; +using ElementArray = array<6>; +struct ElementManager { + ElementManager(); + ElementArray array_; +}; +static ElementArray makeArray() { + if (logLevel()) + LogCapture().stream(); + ElementArray foo; + return foo; +} +ElementManager::ElementManager() : array_(makeArray()) {}