https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96905

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |10.3
            Summary|ICE with consteval          |[10/11 Regression] ICE with
                   |function: internal compiler |consteval function:
                   |error: in cp_gimplify_expr, |internal compiler error: in
                   |at cp/cp-gimplify.c:827     |cp_gimplify_expr, at
                   |                            |cp/cp-gimplify.c:827
                 CC|                            |jason at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is in
#0  cgraph_node::create (decl=<function_decl 0x7fffea93e900 gcd>) at
../../gcc/cgraph.c:508
#1  0x0000000000f2b79c in cgraph_node::get_create (decl=<function_decl
0x7fffea93e900 gcd>) at ../../gcc/cgraph.c:541
#2  0x0000000000b0a700 in mark_needed (decl=<function_decl 0x7fffea93e900 gcd>)
at ../../gcc/cp/decl2.c:2181
#3  0x0000000000cb25b6 in mark_decl_instantiated (result=<function_decl
0x7fffea93e900 gcd>, extern_p=0) at ../../gcc/cp/pt.c:23893
#4  0x0000000000cb6b35 in do_type_instantiation (t=<record_type 0x7fffea93b930
S>, storage=<tree 0x0>, complain=1) at ../../gcc/cp/pt.c:25041
#5  0x0000000000befb77 in cp_parser_explicit_instantiation
(parser=0x7fffea8238e8) at ../../gcc/cp/parser.c:17588

for DECL_IMMEDIATE_FUNCTION_P FUNCTION_DECLs, we really don't want to register
them with the middle-end.  The big question is, do we really care about
explicit vs. implicit instantiation for them.  I mean, if something calls the
consteval function, it doesn't really matter if we instantiate them implicitly
or explicitly.  Where it could matter is diagnostics, if the consteval function
is never called or never called instantiated with a particular template
arguments, and its definition is invalid with those template arguments (but not
invalid to be rejected when parsed uninstantiated).
So if we care about the implicit vs. explicit instantiation of consteval,
perhaps we should just not create the cgraph node in mark_needed for
DECL_IMMEDIATE_FUNCTION_P?

Reply via email to