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 9FFEC385737D for ; Thu, 21 Apr 2022 08:42:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9FFEC385737D Received: from mail-yw1-f199.google.com (mail-yw1-f199.google.com [209.85.128.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-356-2Bxyq8g2NDW2Qv06OH6kvw-1; Thu, 21 Apr 2022 04:42:03 -0400 X-MC-Unique: 2Bxyq8g2NDW2Qv06OH6kvw-1 Received: by mail-yw1-f199.google.com with SMTP id 00721157ae682-2ec44c52e7fso38157167b3.3 for ; Thu, 21 Apr 2022 01:42:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fl3oBQEdTXVySGYnMwbIjzJiSK4SdP6svOLI55xdZuA=; b=0C2sA0nXUnj0JbdQtC1po2ZByWX3TRRzfwN72YbdVYCU/3NwMcxswLxiP9VknzH39J eRdM/6JrA586zmiqLLeciLMpVPumA2o/1VolRot+1kusub6WBMNVPUIuVPqbL+wqDX9z c9Ipsv9xUXYSXSr8fYkKZ3M89/BEjqdBG/hTFXyQSOviZI3SgSDNPpVdAMRuI6gtZoAb vRDYQIU9hjYK+mtVQxDwoWxUjjRyiR202t7HJgDRV14Ba8YsEx8nux551F/25ovceAvD V7CU/OZxm8lxgPPLN/R5mmr3o0Hfm12nqaXLZjXSNKBm4Pw4g3QlHBeJDmfoh3xDeCnt xILA== X-Gm-Message-State: AOAM531Fue54hqKGs5sZdmwILSAMj/UBaXwcYCoIqyXQPnYVYeEUDm1i uMfpYy1/VNJowp6cEtfy+OJRxzaHNy0QRYjVItWlEPJ/FUT57qj4GaRpJogy1SYIOVvh+S1e4cP oGSs9ekS/lMsbUBUsrdLwhv7Te0lD7mU= X-Received: by 2002:a81:58c:0:b0:2ef:5ab8:71f9 with SMTP id 134-20020a81058c000000b002ef5ab871f9mr24157290ywf.313.1650530522644; Thu, 21 Apr 2022 01:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzECiugddrCiFZe/1fIRT3dX66aeCQmb09JnDaEpSWgLzwmwsiqzLXx8JzINEf2mekuwGYpcRxj0uTYwACaMuI= X-Received: by 2002:a81:58c:0:b0:2ef:5ab8:71f9 with SMTP id 134-20020a81058c000000b002ef5ab871f9mr24157283ywf.313.1650530522495; Thu, 21 Apr 2022 01:42:02 -0700 (PDT) MIME-Version: 1.0 References: <20220421033743.1297740-1-ppalka@redhat.com> In-Reply-To: <20220421033743.1297740-1-ppalka@redhat.com> From: Jonathan Wakely Date: Thu, 21 Apr 2022 09:41:51 +0100 Message-ID: Subject: Re: [PATCH] libstdc++: Work around modules ICE in [PR105297] To: Patrick Palka Cc: gcc Patches , "libstdc++" X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-13.1 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_LOW, RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2022 08:42:06 -0000 On Thu, 21 Apr 2022 at 04:38, Patrick Palka via Libstdc++ wrote: > > This makes the initializer for __table in __from_chars_alnum_to_val > dependent in an artificial way, which works around the modules testsuite > ICE reported in PR105297 by preventing the initializer from getting > evaluated at parse time. > > Compared to the alternative workaround of using a non-local class type > for __table, this workaround has the advantage of slightly speeding up > compilation of the header, since now the table will not get > built (via constexpr evaluation) until one of the integer std::from_chars > overloads is actually instantiated. > > Tested on x86_64-pc-linux-gnu, does this look OK for trunk? OK, thanks. > > PR c++/105297 > PR c++/105322 > > libstdc++-v3/ChangeLog: > > * include/std/charconv (__from_chars_alnum_to_val): Make > initializer for __table dependent in an artificial way. > --- > libstdc++-v3/include/std/charconv | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libstdc++-v3/include/std/charconv b/libstdc++-v3/include/std/charconv > index f1ace406017..561234cb2fc 100644 > --- a/libstdc++-v3/include/std/charconv > +++ b/libstdc++-v3/include/std/charconv > @@ -445,7 +445,9 @@ namespace __detail > return __c - '0'; > else > { > - static constexpr auto __table = __from_chars_alnum_to_val_table(); > + // This initializer is deliberately made dependent in order to work > + // around modules bug PR105322. > + static constexpr auto __table = (_DecOnly, __from_chars_alnum_to_val_table()); > return __table.__data[__c]; > } > } > -- > 2.36.0.rc2.10.g1ac7422e39 >