public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nathanieloshead at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112588] ICE in make_decl_rtl when returning str literal when string header imported in module Date: Sat, 18 Nov 2023 00:40:31 +0000 [thread overview] Message-ID: <bug-112588-4-ixiUfaDIaJ@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-112588-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112588 Nathaniel Shead <nathanieloshead at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nathanieloshead at gmail dot com --- Comment #1 from Nathaniel Shead <nathanieloshead at gmail dot com> --- Minimised (the actual offender here is the with std::allocator<char>): // test.h void f(int*); template <typename T> struct S { void g(int n) { f(&n); } }; template struct S<void>; // a.cpp module; #include "test.h" export module test; // b.cpp #include "test.h" import test; So far it seems the issue is that the PARM_DECL in the expression tree of the body of the instantiation for `S<void>::g` is a different node from the actual PARM_DECL in g's DECL_ARGUMENTS; the latter gets RTL but the former does not. The issue is in the deduplication logic for instantiations somewhere. The following patch fixes this issue but causes other issues in the testsuite, and I don't think this is the correct approach anyway: diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 4f5b6e2747a..f2d191fc408 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -8302,9 +8302,7 @@ trees_in::decl_value () if (TREE_CODE (inner) == FUNCTION_DECL) { tree e_inner = STRIP_TEMPLATE (existing); - for (auto parm = DECL_ARGUMENTS (inner); - parm; parm = DECL_CHAIN (parm)) - DECL_CONTEXT (parm) = e_inner; + DECL_ARGUMENTS (inner) = DECL_ARGUMENTS (e_inner); } /* And our result is the existing node. */ (I was originally working on this after attempting to reduce PR99999.)
next prev parent reply other threads:[~2023-11-18 0:40 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-11-17 14:24 [Bug c++/112588] New: " nickbegg at gmail dot com 2023-11-18 0:40 ` nathanieloshead at gmail dot com [this message] 2023-12-01 9:10 ` [Bug c++/112588] " pinskia at gcc dot gnu.org 2024-01-08 17:06 ` ppalka at gcc dot gnu.org 2024-01-17 23:48 ` [Bug c++/112588] [modules] " cvs-commit at gcc dot gnu.org 2024-01-19 1:00 ` hp at gcc dot gnu.org 2024-01-27 10:31 ` nshead at gcc dot gnu.org 2024-03-06 22:08 ` ppalka at gcc dot gnu.org
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=bug-112588-4-ixiUfaDIaJ@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@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: linkBe 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).