[Bug c++/101449] [modules] internal compiler error: in cxx_eval_call_expression
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Oct 17 15:15:08 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101449
--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:
https://gcc.gnu.org/g:3bd5d9a28e1ce4d1615902397b5ad50909839d6d
commit r13-3337-g3bd5d9a28e1ce4d1615902397b5ad50909839d6d
Author: Patrick Palka <ppalka@redhat.com>
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_DECLs
of a constexpr_fundef entry under the assumption that they're just copies
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 rather
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 the
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.
More information about the Gcc-bugs
mailing list