From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E3E133858C55; Mon, 17 Oct 2022 15:15:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E3E133858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666019708; bh=8hZsYdcnIKY7WJeGbEpJedUfEc4tqF6zXT5YmRLtfis=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uqbRaL04TNc66RP70B5vBZL6RSKUJo0mgouq+wI0QWI80ZdMZSj8G4HEy81JtI2W4 xekQYVbFkIr/X3Tip1aAtBqI/I+UwODG2ubgRxLQg3aR9XBXbxiJGKE7MVFmFibtjf xKnqk85rxPPMnCR+At2xpAabi+RFBT73MFlFAtfY= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/101449] [modules] internal compiler error: in cxx_eval_call_expression Date: Mon, 17 Oct 2022 15:15:08 +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: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ppalka at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D101449 --- Comment #3 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:3bd5d9a28e1ce4d1615902397b5ad50909839d6d commit r13-3337-g3bd5d9a28e1ce4d1615902397b5ad50909839d6d Author: Patrick Palka Date: Mon Oct 17 11:14:36 2022 -0400 c++ modules: streaming constexpr_fundef [PR101449] It looks like we currently avoid streaming the RESULT_DECL and PARM_DEC= Ls of a constexpr_fundef entry under the assumption that they're just copi= es of the DECL_RESULT and DECL_ARGUMENTS of the FUNCTION_DECL. Thus we can just make new copies of DECL_RESULT and DECL_ARGUMENTS on stream in rat= her than separately streaming them. But the FUNCTION_DECL's DECL_RESULT and DECL_ARGUMENTS eventually get genericized, whereas the constexpr_fundef entry consists of a copy of t= he FUNCTION_DECL's pre-GENERIC trees. And notably during genericization we lower invisref parms (which entails changing their TREE_TYPE and setting DECL_BY_REFERENCE), the lowered form of which the constexpr evaluator doesn't expect to see, and so this copying approach causes us to ICE for the below testcase. This patch fixes this by faithfully streaming the RESULT_DECL and PARM_DECLs of a constexpr_fundef entry, which seems to just work. Nathan says[1]: Hm, the reason for the complexity was that I wanted to recreate the tree graph where the fndecl came from one TU and the defn came from another one -- we need the definition to refer to argument decls from the already-read decl. However, it seems that for constexpr fns here, that is not needed, resulting in a significant simplification. [1]: https://gcc.gnu.org/pipermail/gcc-patches/2022-October/603662.html PR c++/101449 gcc/cp/ChangeLog: * module.cc (trees_out::write_function_def): Stream the parms and result of the constexpr_fundef entry. (trees_in::read_function_def): Likewise. gcc/testsuite/ChangeLog: * g++.dg/modules/cexpr-3_a.C: New test. * g++.dg/modules/cexpr-3_b.C: New test.=