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.133.124]) by sourceware.org (Postfix) with ESMTPS id DA99F3847718 for ; Wed, 3 Apr 2024 18:16:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DA99F3847718 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 DA99F3847718 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712168202; cv=none; b=Bof6XuXLNZOFEGjZTDMTYlrpQhq13YPD/9zeCNTurje2KAiELEBp7wCY2SbGyUDE2PtLDCD3hvd+0czniRCN1IqNiTOr20l7kK4mD3ukoI5FKPZ9V285UYo9mNWJu1iw49h8/LWI1cvupG9zNVVeDnFncOsS2KSTInBocLiMJD4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1712168202; c=relaxed/simple; bh=OK4ACDBr46E5VpIeKHf+MZZSdhEfDZBJha3rLEvelTg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=mKVR95oMdDii3QrrYpMk+xynK3PYOfRzpPybDRd8F2asaBLNbDhYqU2g60MqefVBb+q8MP+4+ww+1zywbz/7xnCxEnZZD4O7OcJw5NjoJLbBbXeL2V/q4Q1l8+VIF9wRXldluGArnGZiIasaIeq5440STxS7i73SPU5oTe8CwJQ= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712168198; 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: in-reply-to:in-reply-to:references:references; bh=2sd1HOI3AcCvH8ZXvf2c/2x5DJ59sGW3/a+I/DCEeXY=; b=Ulr2eITPK4YgeJ5B879ENs2K6nCwdl4D+To5C0DPzVnw2n18u0t7UnBWK3xBV25SXPztbC KjgFWqgoLJ6dI0CPN3BOct+dRVnq1Hv7Qx64A27qdZP3jfApG99ZuR7XbbPpq3zE4JARGI lPlZn3eovGfCPUgK3bJxy0/aemqUm8I= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-rChv1-RXOG2tkVBiQzO2Bw-1; Wed, 03 Apr 2024 14:16:27 -0400 X-MC-Unique: rChv1-RXOG2tkVBiQzO2Bw-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6962767b1f8so818256d6.3 for ; Wed, 03 Apr 2024 11:16:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712168187; x=1712772987; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2sd1HOI3AcCvH8ZXvf2c/2x5DJ59sGW3/a+I/DCEeXY=; b=bz+ongh+JmhQ9etWhVAS915WCYuArA6deiTALlioApUS8hjQX26GkdRI1IQdicDkYu zD00Uwgk7+Ex3cvhy1V8cEYlyeIZqYcOeudrZIhu2t9yMmmkTtkO4qhKao2ISDochomZ GoW/ZT3w9n31ql85dYi4FhobadaA00Wt+pKepWBjU3eEu2jpFuyOeMDawb2c6tLqBCZc 3RPcd1Kb+fY9pLvRABSnSLyftOXxR9ultoqAdFoTgiuhKOyMpjzFg7GUGdfLX7F+xGg2 WqwOElwKHgRAnrlrwEDgAyVvCnue7RhBnJGUpscaMmrxXTAq0LXFsZAqeReZg82MlZHm bsFw== X-Forwarded-Encrypted: i=1; AJvYcCX3NFoU4pPxiLShx8wpKmZ7zD8UMd6JJ7Py++P8taOG42NyWx7LJc+tiFRqMzz85gzOOy9gzT8YhbWbtptBYNXmaeFEWVj6vA== X-Gm-Message-State: AOJu0YwhgZ6ZyWLVym3BHNd1sk3BnyUorkf6Euw2Jcnm4vB1shD9DwUC jqK/Jw4FuiHf6Wd21wTxzd3wjNKGSGtmngYIEJs/f1Uq44o5eFTFXgZmTHaKoZYnhJcuBX61k0i tcAzAW31CT6F9tT1S0aAkYKBpuHonG9Q8RYw71NvsUaCO9Wnocq+xId8= X-Received: by 2002:ad4:5aa1:0:b0:699:1a5a:495 with SMTP id u1-20020ad45aa1000000b006991a5a0495mr155988qvg.26.1712168187294; Wed, 03 Apr 2024 11:16:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjK27W+KzGZqzrXixh927A5VWnPYpDlQ2deja+g2qKgefbVxC1PTRUdR96ZpAaUiJvVdK7ZQ== X-Received: by 2002:ad4:5aa1:0:b0:699:1a5a:495 with SMTP id u1-20020ad45aa1000000b006991a5a0495mr155963qvg.26.1712168186918; Wed, 03 Apr 2024 11:16:26 -0700 (PDT) Received: from [192.168.1.130] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id gw4-20020a0562140f0400b00698fd28cad3sm4439755qvb.80.2024.04.03.11.16.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Apr 2024 11:16:26 -0700 (PDT) Message-ID: Date: Wed, 3 Apr 2024 14:16:25 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++/modules: Prefer partition indexes when installing imported entities [PR99377] To: Nathaniel Shead , gcc-patches@gcc.gnu.org Cc: Nathan Sidwell , Patrick Palka References: <66056128.050a0220.c7f0.2cc8@mx.google.com> From: Jason Merrill In-Reply-To: <66056128.050a0220.c7f0.2cc8@mx.google.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,SPF_HELO_NONE,SPF_NONE,TXREP 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 3/28/24 08:22, Nathaniel Shead wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, OK for trunk? > > -- >8 -- > > The testcase in comment 15 of the linked PR is caused because the > following assumption in depset::hash::make_dependency doesn't hold: > > if (DECL_LANG_SPECIFIC (not_tmpl) > && DECL_MODULE_IMPORT_P (not_tmpl)) > { > /* Store the module number and index in cluster/section, > so we don't have to look them up again. */ > unsigned index = import_entity_index (decl); > module_state *from = import_entity_module (index); > /* Remap will be zero for imports from partitions, which > we want to treat as-if declared in this TU. */ > if (from->remap) > { > dep->cluster = index - from->entity_lwm; > dep->section = from->remap; > dep->set_flag_bit (); > } > } > > This is because at least for template specialisations, we first see the > declaration in the header unit imported from the partition, and then the > instantiation provided by the partition itself. This means that the > 'import_entity_index' lookup doesn't report that the specialisation was > declared in the partition and thus should be considered as-if it was > part of the TU, and get exported. I think "exported" is the wrong term here; IIUC template specializations are not themselves exported, just the template itself. But if the declaration or point of instantiation of the specialization is within a module instantiation unit, it is reachable to any importers, including the primary module interface unit importing the partition interface unit. Does this work differently if "check" is a separate module rather than a partition? > To fix this, this patch allows, as a special case for installing an > entity from a partition, to overwrite the entity_map entry with the > (later) index into the partition so that this assumption holds again. Rather than special-casing partitions, would it make sense to override a declaration with a definition? Jason