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

            Bug ID: 86397
           Summary: g++ ICE at on valid code in nothrow_spec_p, at
                    cp/except.c:1158
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

g++-6.1 compiles. g++-8.1 and the trunk version crash.


$ g++-trunk -v
Using built-in specs.
COLLECT_GCC=g++-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/9.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 9.0.0 20180703 (experimental) [trunk revision 262340] (GCC) 


$ g++-trunk abc.c
abc.c: In instantiation of ‘void f(int (*)() noexcept (e)) [with bool
<anonymous> = false]’:
abc.c:3:29:   required from here
abc.c:2:22: internal compiler error: in nothrow_spec_p, at cp/except.c:1158
 template <bool> void f(int() noexcept(e)) {}
                      ^
0x615664 nothrow_spec_p(tree_node const*)
        ../../gcc/gcc/vec.h:972
0x9b91b7 canonical_eh_spec(tree_node*)
        ../../gcc/gcc/cp/tree.c:2598
0x8ddfdd canonicalize_for_substitution
        ../../gcc/gcc/cp/mangle.c:422
0x8ddfdd write_type
        ../../gcc/gcc/cp/mangle.c:2107
0x8dd9cc write_type
        ../../gcc/gcc/cp/mangle.c:2306
0x8df6f4 write_method_parms
        ../../gcc/gcc/cp/mangle.c:2799
0x8e564a write_bare_function_type
        ../../gcc/gcc/cp/mangle.c:2735
0x8e6534 mangle_decl_string
        ../../gcc/gcc/cp/mangle.c:3795
0x8e6a50 get_mangled_id
        ../../gcc/gcc/cp/mangle.c:3817
0x8e6a50 mangle_decl(tree_node*)
        ../../gcc/gcc/cp/mangle.c:3855
0x11172cd decl_assembler_name(tree_node*)
        ../../gcc/gcc/tree.c:691
0x115bd9f notice_global_symbol(tree_node*)
        ../../gcc/gcc/varasm.c:1675
0xadc8fa cgraph_node::finalize_function(tree_node*, bool)
        ../../gcc/gcc/cgraphunit.c:451
0x9a1c5f expand_or_defer_fn(tree_node*)
        ../../gcc/gcc/cp/semantics.c:4272
0x961483 instantiate_decl(tree_node*, bool, bool)
        ../../gcc/gcc/cp/pt.c:24084
0x9873d3 instantiate_pending_templates(int)
        ../../gcc/gcc/cp/pt.c:24179
0x8b0448 c_parse_final_cleanups()
        ../../gcc/gcc/cp/decl2.c:4707
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.



$ cat abc.c
void e();
template <bool> void f(int() noexcept(e)) {}
template void f<false>(int());

Reply via email to