public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Patrick Palka <ppalka@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r12-8214] libstdc++: Work around modules ICE in <charconv> [PR105297]
Date: Thu, 21 Apr 2022 12:35:53 +0000 (GMT)	[thread overview]
Message-ID: <20220421123553.16C4D389851D@sourceware.org> (raw)

https://gcc.gnu.org/g:1e6c0e69af8da436e1d1d2d23d8c38410d78ecf2

commit r12-8214-g1e6c0e69af8da436e1d1d2d23d8c38410d78ecf2
Author: Patrick Palka <ppalka@redhat.com>
Date:   Thu Apr 21 08:34:59 2022 -0400

    libstdc++: Work around modules ICE in <charconv> [PR105297]
    
    This makes the initializer for __table in __from_chars_alnum_to_val
    dependent in an artificial way, which works around the reported modules
    testsuite ICE by preventing the compiler from evaluating the initializer
    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 <charconv>, since now the table won't get built (via
    constexpr evaluation) until the integer std::from_chars overload is
    instantiated.
    
            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.

Diff:
---
 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];
 	}
     }


                 reply	other threads:[~2022-04-21 12:35 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220421123553.16C4D389851D@sourceware.org \
    --to=ppalka@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).