From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by sourceware.org (Postfix) with ESMTPS id 0F6F6386F477 for ; Thu, 4 Jan 2024 22:24:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0F6F6386F477 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 0F6F6386F477 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704407097; cv=none; b=v3SP4dr1FXArmt2yUUITkuhcPtaHUKcE1wgt8wsqpDMyluzvmkHlbCXnvEMqk8kgjadGySUBGB1Bj6qQcfiEBRvmZT5SPY3YIRly/aDsy5T568E6IHSledQnqrsBZM//feRh8YWyrzqGRN7PKJr0Xi/FWIqwmvSsFqeSGGI7RAY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704407097; c=relaxed/simple; bh=bkm30Zm4b4si6IJDZcCH6V54l8fJMpDmmWQ5bOBAtYM=; h=DKIM-Signature:Message-ID:Date:From:To:Subject:MIME-Version; b=udNA1QNewfilSdpDHzCWUCGyXqXIFFHQdfIUumTrwXFv1YmxLzZtM5p9qpaDvevDYJTYV6Gfck3jjR58SeiLuwSdwY8WWuUi/wTmdNDJkycHglVQyZJ8h579VFqJNvgVJiWAdE5q7QUBGi+Z4XRpJFeYbP1EF8fYE2MoYXrBjqs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62f.google.com with SMTP id d9443c01a7336-1d480c6342dso6973545ad.2 for ; Thu, 04 Jan 2024 14:24:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704407093; x=1705011893; darn=gcc.gnu.org; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:from:to:cc:subject:date:message-id:reply-to; bh=2e4oJUyBy4MlguzYZkr6zvJXUDvkoH5zlEw8ytdb1rc=; b=VtK8Hf8r6eM0x/b7xbZZO960IoKe792ZfGj5KAMM3fzpSXN/7AmjDVP+ncnYjV+bGs Uvkwr107pY18ThTHZfBKDXqmN/xMJ+6s/DgZ6AnuHKKSf6L1vZi7B1WjRBw87Dfof0v9 MHqkxzinnVMossp+lotDoxoFpqYVfOhVv/VA0r44LvGDOqSaIS91rjkmUauU7n3Q+4hk vXjUwj7CFOoBPrT14lA2aaZItk9GVx3sy/ld+D0wBSuMSeg+w7YDXcQKOODaC0IfI4bx KDOnkzr50TI3jC0L6puNJzirrOTCgtA3f9okkBdUnoQJr6Ty5iMBn9mA9K/nWOU6TM+2 FPdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704407093; x=1705011893; h=in-reply-to:content-disposition:mime-version:references:subject:cc :to:from:date:message-id:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=2e4oJUyBy4MlguzYZkr6zvJXUDvkoH5zlEw8ytdb1rc=; b=SWmGLQJpW5Gjw9JJSYg2bRNdRyX6AkHcVijDxtq7edMcOGfIVGOb0IcqLbHD0RHBuc mj/zX8UaKVvZL49sESY+VrIvQ70uk4VCZaoIFFYSloiISVuktycnEKxEyA8/0hMu2DCf +dikQuP60kTyjeDdHWfttCotukr9OTU06G1itLAjawHS9WtGW03kjR0AVQk3/bq0H3Ou TaeYzYvIff/wwEG014Seqn9CmUv1p2kWmOCTUspdnqXX5pIJJdC56FwrLyf5rm+5r1wm m5UKz3ddMKTDVVHQKTFBHEXNn66jKHeaH9xIZnZpbrfr6NnG07lzelFYI1emkXb8jsVU 6TmA== X-Gm-Message-State: AOJu0YxudCIsi7RnijgQRuUQL3ySjhXWymkGef+zbWfyTu+GetkLmB46 j9i1tevKeQeWHGz35aWttCT71NhP6GY= X-Google-Smtp-Source: AGHT+IEGeJdAXTQiuN6mpgE24y/kz/MzH5Js6jE1+EFL2WiaeefnpFpqH20rgoWcUhP47wJfdrgnAw== X-Received: by 2002:a17:902:ec8a:b0:1d4:ca3d:742e with SMTP id x10-20020a170902ec8a00b001d4ca3d742emr1402147plg.67.1704407092914; Thu, 04 Jan 2024 14:24:52 -0800 (PST) Received: from Thaum. (60-241-118-84.tpgi.com.au. [60.241.118.84]) by smtp.gmail.com with ESMTPSA id t7-20020a170902a5c700b001d3dff2575fsm109042plq.52.2024.01.04.14.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jan 2024 14:24:52 -0800 (PST) Message-ID: <65973034.170a0220.956b9.05dd@mx.google.com> X-Google-Original-Message-ID: Date: Fri, 5 Jan 2024 09:24:47 +1100 From: Nathaniel Shead To: Jason Merrill Cc: gcc-patches@gcc.gnu.org, Nathan Sidwell , Patrick Palka Subject: Re: c++/modules: Emit definitions of ODR-used static members imported from modules [PR112899] References: <659490fd.170a0220.1ce2e.503a@mx.google.com> <8323d337-4bc3-4e65-9944-a2d579e66792@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8323d337-4bc3-4e65-9944-a2d579e66792@redhat.com> X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_SHORT,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Thu, Jan 04, 2024 at 03:31:50PM -0500, Jason Merrill wrote: > On 1/2/24 17:40, Nathaniel Shead wrote: > > Static data members marked 'inline' should be emitted in TUs where they > > are ODR-used. We need to make sure that statics imported from modules > > are correctly added to the 'pending_statics' map so that they get > > emitted if needed, otherwise the attached testcase fails to link. > > Hmm, this seems wrong to me; I'd think that static data members marked > inline should be emitted in the module, and not in importers. > > Jason > That's what I'd initially thought too, but this is at least consistent with non-class inlines (variables and functions), which similarly only get emitted in TUs that they're ODR-used rather than always (and only) being emitted within the module. I guess an alternative would be to change it around so that all exported definitions are marked as needed in the module interface file (and emitted there), and then setting some flag so that they're never emitted in importers. I'm not entirely sure what flag that would be though, I still haven't quite wrapped my head what controls what with regards to this, and I'm not convinced it wouldn't break template instantiations. I wonder if this might also be related to the issue Nathan noted with regards to block-scope class methods, which I haven't completely worked out how to solve yet otherwise (see https://gcc.gnu.org/pipermail/gcc-patches/2023-November/638223.html). Nathaniel