From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 E53943858401 for ; Mon, 22 Aug 2022 17:45:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E53943858401 Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-383-FgUL6zZpPmi4scu9OSdpEA-1; Mon, 22 Aug 2022 13:45:35 -0400 X-MC-Unique: FgUL6zZpPmi4scu9OSdpEA-1 Received: by mail-qk1-f198.google.com with SMTP id s9-20020a05620a254900b006b54dd4d6deso10170455qko.3 for ; Mon, 22 Aug 2022 10:45:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc; bh=ixA1Cgo1s3fxb84zm5j29XaKu9NyNp9aWZqA7CG17Jk=; b=duZs4q7T9hFrA359nZOP8aR9GA2b/jSwsBr0vI6/LHo+u/mbwUGft1AYSy9AieGGVg nJH5v9wbHJ2eiUAjgD7JrD/IlTAUCrvOu9QDvicKy5ADoj7E29YwiLQQqrQz4Nqq4gzt IcCQUzVuB8jAK2TU/OfjTfHooXOhhcPx/29/etGAabYtb1El4FTXtXusoTJ1Zn2DX8oL nmhWH5EfSKaC0nPvdw6pZDhcgvOCn2ZLsFYsYmuIToLKKX4aalq0seTNhcY1HJisezFU +yCCJyStMdLyhKYXc5lyz5Yw76kAsjPbrvifYjORAIzAXIa1kkv/JWp7Gn6wCVvZ7wGV atVg== X-Gm-Message-State: ACgBeo1ERIuJ0vMqYSY5Jj3qMIGM69bOdgS2UhRJgk6kmDYKnOHbfQOD g5acAo9isnmFSIkKeAdj83gw1eQ14M09sIrH8MAdfxx5xRhQ542NKSDJzCHtSShqrtnlFdMqB7i KElEcqd9qGEfv/PXrRA== X-Received: by 2002:a05:6214:c2b:b0:476:813a:b173 with SMTP id a11-20020a0562140c2b00b00476813ab173mr16685895qvd.31.1661190330409; Mon, 22 Aug 2022 10:45:30 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Xu6qF7QzsZYK08ciZ6VYaMyhy43Y1jZbax/SK0/+MeAgRPLDEbaxhY6oGUEX/wV9eJgMHOA== X-Received: by 2002:a05:6214:c2b:b0:476:813a:b173 with SMTP id a11-20020a0562140c2b00b00476813ab173mr16685847qvd.31.1661190329696; Mon, 22 Aug 2022 10:45:29 -0700 (PDT) Received: from redhat.com ([2601:184:4780:4310::e531]) by smtp.gmail.com with ESMTPSA id y7-20020a05620a09c700b006b93b61bc74sm10558203qky.9.2022.08.22.10.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Aug 2022 10:45:29 -0700 (PDT) Date: Mon, 22 Aug 2022 13:45:27 -0400 From: Marek Polacek To: Andrew Pinski Cc: GCC Patches , Richard Biener Subject: [PATCH v2] testsuite: Add test for r11-4123 Message-ID: References: <20220822165737.39118-1-polacek@redhat.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/2.2.6 (2022-06-05) X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-12.7 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-List-Received-Date: Mon, 22 Aug 2022 17:45:39 -0000 On Mon, Aug 22, 2022 at 10:16:23AM -0700, Andrew Pinski wrote: > On Mon, Aug 22, 2022 at 9:58 AM Marek Polacek via Gcc-patches > wrote: > > > > 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 > > > > 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" } > > It seems better to put it in g++.dg/torture and remove -O part. > And then it will be tested for more than before. Sure, I can move it. > Maybe even just mark makeArray as always_inline/inline and you might > be able to remove the param also. I can't, it doesn't reproduce the issue then. -- >8 -- 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 gcc/testsuite/ChangeLog: * g++.dg/torture/phi-1.C: New test. --- gcc/testsuite/g++.dg/torture/phi-1.C | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 gcc/testsuite/g++.dg/torture/phi-1.C diff --git a/gcc/testsuite/g++.dg/torture/phi-1.C b/gcc/testsuite/g++.dg/torture/phi-1.C new file mode 100644 index 00000000000..69fb3d7ba38 --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/phi-1.C @@ -0,0 +1,28 @@ +// { dg-do compile { target c++11 } } +// { dg-options "--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()) {} base-commit: b6316324fceaef431799a8b386de5cc9881d6898 -- 2.37.2