Message ID | 20231025183245.837312-1-ppalka@redhat.com |
---|---|
State | Unresolved |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:d641:0:b0:403:3b70:6f57 with SMTP id cy1csp156127vqb; Wed, 25 Oct 2023 11:33:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG8+BfLSWWuvW3t+OM5DKbLvPUYsjhnZLZdkxH5b42kEJnBkf/MUpwCYovky5x4vQMsBmyt X-Received: by 2002:a05:620a:170a:b0:775:903e:388c with SMTP id az10-20020a05620a170a00b00775903e388cmr20042407qkb.2.1698258799019; Wed, 25 Oct 2023 11:33:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1698258799; cv=pass; d=google.com; s=arc-20160816; b=Fb//TLrdXSREUqoy1pKut3rPjd96n8S3CWDBODoTZDA9q+Br9tC8Y6jZkrAS0B6r8O PJADPwIO3ygjHcGhS6FnWiIaf2NCtrgJONaM6VQKtcVIA1808KFeZBMkQl496SiCcMOY FuqBx/gvGlVtUQBtSbEBIzb847gacKApduo4kp9zJLmeJLjjoMuM65wYzgiN2rfj96Fp +keT7houWYBIL0kuLF+hfh1UVsJdG7MrF9X4z1BU/Ko15ff5SKbZboKhWW5nvnND+qHC jjXYdQP5sb3teuZkwMGQ11m+H0WO6sWjyEjCior/g4DZ0OPBLGwQOHVIjzE20YCrb8ZR MmBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=5fhCcs+6w+JIsewdEpGSim6029Dj5E9SfmDpqLRlz+Y=; fh=2rASkADSwGVpvDy7jg5DSLYvTiE4uxP+mXuVMyfs8f4=; b=cySjVdxh1P7vBctifZxi9H4X7HmLgV9SE9i78aHPlKDB7dleB0XSuld4Po7L5ONja9 tYQR2TwzsCWlcsO3ons1OUBLYnfLS9Wren6tXiY36Fdx3JoGFUsRKHksM6GJf45rctQZ c6WDpZ65TtoX/k6BYeAXenMB9jcuO/YxhRv2Ax2hYHN0rAjnhDxy55uiL6W1ZpKuICCx LvRiikRpbuwNHEYhn/OnAPtgxN/lKhhYdP8lJFazvYNmW5LnL/QYlCY+YALNYg5IPHpu tZNJxioKnuUorTLLKYjUYT336EUwLuMeap/hC8mVdOwKeFYol5N6lg1ViS3ZJi2iE8Vb TTdQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aIjNM+bP; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id bs14-20020a05620a470e00b00775d3ebaab5si8872842qkb.286.2023.10.25.11.33.18 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 11:33:19 -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=@redhat.com header.s=mimecast20190719 header.b=aIjNM+bP; arc=pass (i=1); 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=redhat.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9D82A385773A for <ouuuleilei@gmail.com>; Wed, 25 Oct 2023 18:33:18 +0000 (GMT) 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 F20313858D33 for <gcc-patches@gcc.gnu.org>; Wed, 25 Oct 2023 18:32:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org F20313858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org F20313858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698258776; cv=none; b=LBViu/KyvAnGlqqvqt13fdZXGbfs9bIaVE95WLzKONI1ePt09RnIy1ZQs5ePDFBLW92fVlLMd3TmnCxJiEkNVSlOht7y1V9dMDans83AGcb/r3iODuc2ObEv+o8yPY2/mJBXP+Pkq3ClRTHfIC3NzeQ+DpdDVp05r1iNuyi+OQE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1698258776; c=relaxed/simple; bh=up4EO1TxqUwZwL+8oPWsVBbyil+sea28N1hrhxsuGtA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=e5XddD4ay6895iHq2Boa7zKQeCzSbaPDO629QcSH6OIoaR/fIRjMUd8+ivvQd6kZTG52yoaHkfkcPR5wqeEbXqSiuW6mqRQ8G0Bg9UXlkv+AMX3zJfWsnerjY4mQs9oOFk8MUauNs/XRsqGkrwE2iKqSfhmQkURarrAzvtlhCWE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698258774; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=5fhCcs+6w+JIsewdEpGSim6029Dj5E9SfmDpqLRlz+Y=; b=aIjNM+bPxspaEVTJ08H+nzOmj7HLk0pB2/9VLKM3q7xuzq1dgLB4TZLro8fe1UlTntIYlH 99wfSml+bSd1nX0osIG6Sklz6hfr0NJ8f5UBg50wvCBMB385ar65DCHabSzrArRKFe3dgk exWE3I7UKW+OUidsDNWRI4zPC5/7voo= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-85-nDn7ztl2Ovm4LIXA8o_ggA-1; Wed, 25 Oct 2023 14:32:53 -0400 X-MC-Unique: nDn7ztl2Ovm4LIXA8o_ggA-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-41cd46aa351so1059401cf.3 for <gcc-patches@gcc.gnu.org>; Wed, 25 Oct 2023 11:32:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698258772; x=1698863572; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5fhCcs+6w+JIsewdEpGSim6029Dj5E9SfmDpqLRlz+Y=; b=OlHNEaNPzrWYJaZ+HDNq8jPabUscj5hUdPQT/Rz0npcezVZey1Eqg8h3A0Iwyb5cl1 IU//S/wSmSBA7rXpHQWL2gfB7pTcZ1CUkJoUzpIdVPdWcivCUvkR0BrgaoUsH5JygOzI bqtmENJ1b74I/b1GasphNUWfYRk3eB9pWdl99K0UCbwrz+999SRNqgbuLEeBvbaFluI3 /gwCG49TXivVVdSGnYfSS7nRd9q9E0tqUu4rbUqcycO4HCgmgX5D6dkks4OlqOFakpdS DllkyttIZBM5no0bsoX30LPdxiR5aDr6PT0yYOQFmF6n15c3fjjbB5O3DFQu8L2SEZPk WvWw== X-Gm-Message-State: AOJu0Yw1/wtK3txZ9HsvZ+6R1r51IlAy1zLBMPt81me2/wH2r1k2yb2p Qn+AI78fSxxQhRf2NwQMllaCo3pU9V9Q9OixNP6gRvYWfl5wvqKCLM9+jB0rfytJcUkEPPBr0d9 XrdEqvWusPsx7mITWAJmwqM8NJEuHDva1TO1X8VURvChvc0PgpDLXr9yrFFiWmlhfffiKFKkFIl I= X-Received: by 2002:ac8:57d3:0:b0:41c:c60c:7c1f with SMTP id w19-20020ac857d3000000b0041cc60c7c1fmr17674160qta.6.1698258772445; Wed, 25 Oct 2023 11:32:52 -0700 (PDT) X-Received: by 2002:ac8:57d3:0:b0:41c:c60c:7c1f with SMTP id w19-20020ac857d3000000b0041cc60c7c1fmr17674141qta.6.1698258772119; Wed, 25 Oct 2023 11:32:52 -0700 (PDT) Received: from localhost.localdomain (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id g22-20020ac84dd6000000b004166905aa2asm4386627qtw.28.2023.10.25.11.32.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 11:32:51 -0700 (PDT) From: Patrick Palka <ppalka@redhat.com> To: gcc-patches@gcc.gnu.org Cc: jason@redhat.com, nathan@acm.org, Patrick Palka <ppalka@redhat.com> Subject: [PATCH] c++/modules: fix up recent testcases Date: Wed, 25 Oct 2023 14:32:44 -0400 Message-ID: <20231025183245.837312-1-ppalka@redhat.com> X-Mailer: git-send-email 2.42.0.482.g2e8e77cbac MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP 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.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1780753418287591693 X-GMAIL-MSGID: 1780753418287591693 |
Series |
c++/modules: fix up recent testcases
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | warning | Git am fail log |
Commit Message
Patrick Palka
Oct. 25, 2023, 6:32 p.m. UTC
Tested on x86_64-pc-linux-gnu, does this look OK for trunk? Declaring get() inline seems necessary to avoid link failure: /usr/bin/ld: /tmp/ccwdv6Co.o: in function `g3@pr105322.Decltype()': decltype-1_b.C:(.text._ZW8pr105322W8Decltype2g3v[_ZW8pr105322W8Decltype2g3v]+0x18): undefined reference to `f@pr105322.Decltype()::A::get()' Not sure if that's expected? -- >8 -- This fixes some minor issues with the testcases from r14-4806-g084addf8a700fa. gcc/testsuite/ChangeLog: * g++.dg/modules/decltype-1_a.C: Add missing } to dg-module-do directive. Declare f()::A::get() inline. * g++.dg/modules/lambda-5_a.C: Add missing } to dg-module-do directive. --- gcc/testsuite/g++.dg/modules/decltype-1_a.C | 4 ++-- gcc/testsuite/g++.dg/modules/lambda-5_a.C | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
Comments
Patrick, thanks for noticing this, and this is a suitable workaround for another bug. We should either be emitting the definition of that member function in the object file of its containing function. Or it should be implicitly inline. I know in module perview the in-class defined member functions at namespace scope are /not/ implicitly inline. But I can't recall what the std says about non-namespace scope classes. Ah, it appears to be the former we should be doing: [class.mfct] If a member function is attached to the global module and is defined (9.5) in its class definition, it is inline (9.2.8). Notice we can get into the weird situation that the member functions of a local class of a module-purview inline function might not themselves be inline! On 10/25/23 14:32, Patrick Palka wrote: > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? > > Declaring get() inline seems necessary to avoid link failure: > > /usr/bin/ld: /tmp/ccwdv6Co.o: in function `g3@pr105322.Decltype()': > decltype-1_b.C:(.text._ZW8pr105322W8Decltype2g3v[_ZW8pr105322W8Decltype2g3v]+0x18): undefined reference to `f@pr105322.Decltype()::A::get()' > > Not sure if that's expected? > > -- >8 -- > > This fixes some minor issues with the testcases from > r14-4806-g084addf8a700fa. > > gcc/testsuite/ChangeLog: > > * g++.dg/modules/decltype-1_a.C: Add missing } to dg-module-do > directive. Declare f()::A::get() inline. > * g++.dg/modules/lambda-5_a.C: Add missing } to dg-module-do > directive. > --- > gcc/testsuite/g++.dg/modules/decltype-1_a.C | 4 ++-- > gcc/testsuite/g++.dg/modules/lambda-5_a.C | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/testsuite/g++.dg/modules/decltype-1_a.C b/gcc/testsuite/g++.dg/modules/decltype-1_a.C > index ca66e8b598a..6512f151aae 100644 > --- a/gcc/testsuite/g++.dg/modules/decltype-1_a.C > +++ b/gcc/testsuite/g++.dg/modules/decltype-1_a.C > @@ -1,5 +1,5 @@ > // PR c++/105322 > -// { dg-module-do link > +// { dg-module-do link } > // { dg-additional-options -fmodules-ts } > // { dg-module-cmi pr105322.Decltype } > > @@ -7,7 +7,7 @@ export module pr105322.Decltype; > > auto f() { > struct A { int m; > - int get () { return m; } > + inline int get () { return m; } > }; > return A{}; > } > diff --git a/gcc/testsuite/g++.dg/modules/lambda-5_a.C b/gcc/testsuite/g++.dg/modules/lambda-5_a.C > index 6b589d4965c..37d0e77b1e1 100644 > --- a/gcc/testsuite/g++.dg/modules/lambda-5_a.C > +++ b/gcc/testsuite/g++.dg/modules/lambda-5_a.C > @@ -1,5 +1,5 @@ > // PR c++/105322 > -// { dg-module-do link > +// { dg-module-do link } > // { dg-additional-options -fmodules-ts } > // { dg-module-cmi pr105322.Lambda } >
On 10/25/23 14:32, Patrick Palka wrote: > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? > > Declaring get() inline seems necessary to avoid link failure: > > /usr/bin/ld: /tmp/ccwdv6Co.o: in function `g3@pr105322.Decltype()': > decltype-1_b.C:(.text._ZW8pr105322W8Decltype2g3v[_ZW8pr105322W8Decltype2g3v]+0x18): undefined reference to `f@pr105322.Decltype()::A::get()' > > Not sure if that's expected? That seems like a bug. My guess is that the bug is treating f()::A::get as internal linkage, but Nathan should have a better understanding of how it's supposed to work. > -- >8 -- > > This fixes some minor issues with the testcases from > r14-4806-g084addf8a700fa. > > gcc/testsuite/ChangeLog: > > * g++.dg/modules/decltype-1_a.C: Add missing } to dg-module-do > directive. Declare f()::A::get() inline. > * g++.dg/modules/lambda-5_a.C: Add missing } to dg-module-do > directive. > --- > gcc/testsuite/g++.dg/modules/decltype-1_a.C | 4 ++-- > gcc/testsuite/g++.dg/modules/lambda-5_a.C | 2 +- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/gcc/testsuite/g++.dg/modules/decltype-1_a.C b/gcc/testsuite/g++.dg/modules/decltype-1_a.C > index ca66e8b598a..6512f151aae 100644 > --- a/gcc/testsuite/g++.dg/modules/decltype-1_a.C > +++ b/gcc/testsuite/g++.dg/modules/decltype-1_a.C > @@ -1,5 +1,5 @@ > // PR c++/105322 > -// { dg-module-do link > +// { dg-module-do link } > // { dg-additional-options -fmodules-ts } > // { dg-module-cmi pr105322.Decltype } > > @@ -7,7 +7,7 @@ export module pr105322.Decltype; > > auto f() { > struct A { int m; > - int get () { return m; } > + inline int get () { return m; } > }; > return A{}; > } > diff --git a/gcc/testsuite/g++.dg/modules/lambda-5_a.C b/gcc/testsuite/g++.dg/modules/lambda-5_a.C > index 6b589d4965c..37d0e77b1e1 100644 > --- a/gcc/testsuite/g++.dg/modules/lambda-5_a.C > +++ b/gcc/testsuite/g++.dg/modules/lambda-5_a.C > @@ -1,5 +1,5 @@ > // PR c++/105322 > -// { dg-module-do link > +// { dg-module-do link } > // { dg-additional-options -fmodules-ts } > // { dg-module-cmi pr105322.Lambda } >
diff --git a/gcc/testsuite/g++.dg/modules/decltype-1_a.C b/gcc/testsuite/g++.dg/modules/decltype-1_a.C index ca66e8b598a..6512f151aae 100644 --- a/gcc/testsuite/g++.dg/modules/decltype-1_a.C +++ b/gcc/testsuite/g++.dg/modules/decltype-1_a.C @@ -1,5 +1,5 @@ // PR c++/105322 -// { dg-module-do link +// { dg-module-do link } // { dg-additional-options -fmodules-ts } // { dg-module-cmi pr105322.Decltype } @@ -7,7 +7,7 @@ export module pr105322.Decltype; auto f() { struct A { int m; - int get () { return m; } + inline int get () { return m; } }; return A{}; } diff --git a/gcc/testsuite/g++.dg/modules/lambda-5_a.C b/gcc/testsuite/g++.dg/modules/lambda-5_a.C index 6b589d4965c..37d0e77b1e1 100644 --- a/gcc/testsuite/g++.dg/modules/lambda-5_a.C +++ b/gcc/testsuite/g++.dg/modules/lambda-5_a.C @@ -1,5 +1,5 @@ // PR c++/105322 -// { dg-module-do link +// { dg-module-do link } // { dg-additional-options -fmodules-ts } // { dg-module-cmi pr105322.Lambda }