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 35C9A3858C54 for ; Thu, 21 Apr 2022 03:37:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 35C9A3858C54 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.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-515-qxiQkWjVOAaWswTzXxO1ag-1; Wed, 20 Apr 2022 23:37:50 -0400 X-MC-Unique: qxiQkWjVOAaWswTzXxO1ag-1 Received: by mail-qv1-f71.google.com with SMTP id j7-20020a05621419c700b004461f75de48so2995558qvc.10 for ; Wed, 20 Apr 2022 20:37:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=i8oPyp+H6aAZ2ycrYNWIjipxiw5tA45+Lhkvtsuj8qA=; b=sGkbWPRnCp/fA6k5gR8osmSFdHNfqCUFnsiuhLa9KFfdkDjWbAI0lO2l2rk7FYwLRy wP5HJypFjEqtqYceF00O7F33LpL94XAlpE6eWvGn1YKApRvDDBvFjBpoGyqiU2Gmctkx PQDBJ3i9+X0X+xt9rkoxFT0ryg/AOCnfnjuv4de0XJ5MgQWARP4ZdYY34ChThVCMEHmp SGcmy3hA9QI9Sm6y5G4aTPOqnIQNYg2vPTtE7e0uZ/MY9sJ3QSPJzThMjOO7YSSAu1SU dfDt/04cQFq0ngPzX7/meSyLO4Yhz5RcF3/f4hgFLX/Uy0LEwntgTwCIaNIgU4JJBCTo KHGQ== X-Gm-Message-State: AOAM532V8mI4njEoyjRH/J5++EofmNxuW5in5+POYat2mR9JTXYUQHdx VPL0s1MWcfIyYMTWFNK9HtM0qzet20VfWMY1al1e7/XxFpFH/a4FKb9m/CnXmla/0lnsWkbMUJg oaxjekaj6mpsoli8= X-Received: by 2002:a37:b6c5:0:b0:69b:d92c:7de9 with SMTP id g188-20020a37b6c5000000b0069bd92c7de9mr14922502qkf.541.1650512270157; Wed, 20 Apr 2022 20:37:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzVJ2Otxc/4LnehG4oGs4ybDyXsexvmEuxGzQUBmFlhUlZPHuEz86rfr/mEB75Oa9jBM2Zmaw== X-Received: by 2002:a37:b6c5:0:b0:69b:d92c:7de9 with SMTP id g188-20020a37b6c5000000b0069bd92c7de9mr14922498qkf.541.1650512269957; Wed, 20 Apr 2022 20:37:49 -0700 (PDT) Received: from localhost.localdomain (ool-18e40894.dyn.optonline.net. [24.228.8.148]) by smtp.gmail.com with ESMTPSA id a23-20020a05620a103700b00699d49c511dsm2393805qkk.104.2022.04.20.20.37.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Apr 2022 20:37:49 -0700 (PDT) From: Patrick Palka To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Patrick Palka Subject: [PATCH] libstdc++: Work around modules ICE in [PR105297] Date: Wed, 20 Apr 2022 23:37:43 -0400 Message-Id: <20220421033743.1297740-1-ppalka@redhat.com> X-Mailer: git-send-email 2.36.0.rc2.10.g1ac7422e39 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=-14.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_LOW, RCVD_IN_MSPIKE_H4, 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 03:37:54 -0000 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? 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