Bug 95678 - [9 Regression] ICE in dependent_type_p, at cp/pt.c:25610
Summary: [9 Regression] ICE in dependent_type_p, at cp/pt.c:25610
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 9.3.1
: P3 normal
Target Milestone: 9.4
Assignee: Patrick Palka
URL:
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2020-06-15 09:12 UTC by Matthias Klose
Modified: 2020-06-16 19:23 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 9.3.0
Known to fail:
Last reconfirmed: 2020-06-16 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2020-06-15 09:12:28 UTC
seen with the gcc-9 branch 20200518, not with the gcc-10 branch.

$ cat unique.ii
# 7 "" 3
template <class b> struct c {
  using d = b;
  template <class bb, class e> auto operator()(bb l, e) -> decltype(d{l});
};
template <class f, template <class> class g> h() {
  using i = g<f>;
  int a[]{};
  unsigned j;
  i{}(a, j);
}
k() { h<int *, c>(); }

$ g++ -c -std=c++14 -Wall -fconcepts unique.ii
: In instantiation of ‘decltype (c<b>::d{l}) c<b>::operator()(bb, e) [with bb = int*; e = unsigned int; b = int*]’:
:9:37: internal compiler error: in dependent_type_p, at cp/pt.c:25610
0x7f56f3effe0a __libc_start_main
        ../csu/libc-start.c:308
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 1 Richard Biener 2020-06-15 12:11:21 UTC
I can't reproduce it.  What version works for you?
Comment 2 Matthias Klose 2020-06-15 18:15:11 UTC
the gcc-9 branch from 20200408 works for me. 20200615 also fails.

: In instantiation of ‘decltype (c<b>::d{l}) c<b>::operator()(bb, e) [with bb = int*; e = unsigned int; b = int*]’:
:9:37: internal compiler error: in dependent_type_p, at cp/pt.c:25619
0x5abade dependent_type_p(tree_node*)
        ../../src/gcc/cp/pt.c:25619
0x5abade dependent_type_p(tree_node*)
        ../../src/gcc/cp/pt.c:25610
0xd9e253 zero_init_expr_p(tree_node*)
        ../../src/gcc/cp/tree.c:4387
0x82b8a7 write_expression
        ../../src/gcc/cp/mangle.c:3177
0x11f7673 write_type
        ../../src/gcc/cp/mangle.c:2307
0xeaef6a write_encoding
        ../../src/gcc/cp/mangle.c:2688
0xeaef6a write_mangled_name
        ../../src/gcc/cp/mangle.c:789
0xeaef6a mangle_decl_string
        ../../src/gcc/cp/mangle.c:3839
0xeacbbf get_mangled_id
        ../../src/gcc/cp/mangle.c:3861
0xeacbbf mangle_decl(tree_node*)
        ../../src/gcc/cp/mangle.c:3899
0xe9b7ef decl_assembler_name(tree_node*)
        ../../src/gcc/tree.c:701
0xe9b7ef symbol_table::insert_to_assembler_name_hash(symtab_node*, bool)
        ../../src/gcc/symtab.c:174
0xe9b7ef symbol_table::insert_to_assembler_name_hash(symtab_node*, bool)
        ../../src/gcc/symtab.c:161
0xe9b7ef symbol_table::symtab_initialize_asm_name_hash()
        ../../src/gcc/symtab.c:266
0xe9b7ef symbol_table::symtab_initialize_asm_name_hash()
        ../../src/gcc/symtab.c:259
0xead95b analyze_functions
        ../../src/gcc/cgraphunit.c:1298
0xeac067 symbol_table::finalize_compilation_unit()
        ../../src/gcc/cgraphunit.c:2837
Please submit a full bug report,
with preprocessed source if appropriate.
Comment 3 Patrick Palka 2020-06-16 12:32:33 UTC
Judging by the backtrace, I suspect this is ICE is due to r9-8526.  I think r10-7933 needs to be backported to the 9 branch.
Comment 4 GCC Commits 2020-06-16 19:18:28 UTC
The releases/gcc-9 branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:d9867034e033c08fdabaebfe2f0914d7d9bb25c6

commit r9-8680-gd9867034e033c08fdabaebfe2f0914d7d9bb25c6
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jun 16 12:16:02 2020 -0400

    c++: zero_init_expr_p of dependent expression [PR95678]
    
    gcc/cp/ChangeLog:
    
            PR c++/95678
            * tree.c (zero_init_expr_p): Use uses_template_parms instead of
            dependent_type_p.
    
    gcc/testsuite/ChangeLog:
    
            PR c++/95678
            * g++.dg/cpp0x/dependent3.C: New test.
    
    (cherry picked from commit 9a453da5cac7b6610cd342a7bea256acba5e61e1)
Comment 5 Patrick Palka 2020-06-16 19:23:30 UTC
This should be fixed now.