From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E12C13857B85; Sat, 18 Nov 2023 00:40:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E12C13857B85 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700268032; bh=O34Ia8EZOKHcIAHhe+K+eacc26CjtPoOpuc5P6rTBLg=; h=From:To:Subject:Date:In-Reply-To:References:From; b=h92S4FRmH9SUL97nmJlUUJ5JG3Rkgrg266IRV4ZppVvp7AGaXsNIvCCDbN+E2E96K wOO/tWAVU7rwvRR7jELcPRwPSnMvosYYd/E4rZJA3UeXHVTcH1Wv0QZ1r9bvvir/CQ acLBixFwfJbmiEIAw5RtPDjneMU71QxOV8opZ36I= From: "nathanieloshead at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: nathanieloshead at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112588 Nathaniel Shead changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nathanieloshead at gmail d= ot com --- Comment #1 from Nathaniel Shead --- Minimised (the actual offender here is the with std::allocator): // test.h void f(int*); template struct S { void g(int n) { f(&n); } }; template struct S; // 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 t= he body of the instantiation for `S::g` is a different node from the act= ual PARM_DECL in g's DECL_ARGUMENTS; the latter gets RTL but the former does no= t. The issue is in the deduplication logic for instantiations somewhere. The following patch fixes this issue but causes other issues in the testsui= te, 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) =3D=3D FUNCTION_DECL) { tree e_inner =3D STRIP_TEMPLATE (existing); - for (auto parm =3D DECL_ARGUMENTS (inner); - parm; parm =3D DECL_CHAIN (parm)) - DECL_CONTEXT (parm) =3D e_inner; + DECL_ARGUMENTS (inner) =3D DECL_ARGUMENTS (e_inner); } /* And our result is the existing node. */ (I was originally working on this after attempting to reduce PR99999.)=