https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71814
Bug ID: 71814 Summary: ICE on valid C++11 code: in write_type, at cp/mangle.c:2158 Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: su at cs dot ucdavis.edu Target Milestone: --- The following C++11 code causes an ICE when compiled with the current GCC trunk on x86_64-linux-gnu in both 32-bit and 64-bit modes. It also affects 6.1.x and is a regression from 5.4.x. $ g++-trunk -v Using built-in specs. COLLECT_GCC=g++-trunk COLLECT_LTO_WRAPPER=/usr/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/7.0.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../gcc-source-trunk/configure --enable-languages=c,c++,lto --prefix=/usr/local/gcc-trunk --disable-bootstrap Thread model: posix gcc version 7.0.0 20160707 (experimental) [trunk revision 238117] (GCC) $ $ g++-5.4 -std=c++11 -c small.cpp $ clang++-3.8 -std=c++11 -c small.cpp $ $ g++-trunk -std=c++11 -c small.cpp small.cpp: In instantiation of ‘void foo(int (&)[sizeof (int, U ..., int, typename U::type ...)]) [with U = {A<int>, A<float>}; TN<int, U ..., int, typename U::type ...> = int [6]]’: small.cpp:8:57: required from here small.cpp:6:6: internal compiler error: in write_type, at cp/mangle.c:2158 void foo (TN < int, U ..., int, typename U::type ... >&) {} ^~~ 0x861088 write_type ../../gcc-source-trunk/gcc/cp/mangle.c:2158 0x8622aa write_array_type ../../gcc-source-trunk/gcc/cp/mangle.c:3319 0x8622aa write_type ../../gcc-source-trunk/gcc/cp/mangle.c:1935 0x861411 write_type ../../gcc-source-trunk/gcc/cp/mangle.c:2082 0x8639d7 write_method_parms ../../gcc-source-trunk/gcc/cp/mangle.c:2602 0x863d70 write_bare_function_type ../../gcc-source-trunk/gcc/cp/mangle.c:2544 0x865f25 mangle_decl_string ../../gcc-source-trunk/gcc/cp/mangle.c:3515 0x866078 get_mangled_id ../../gcc-source-trunk/gcc/cp/mangle.c:3537 0x866348 mangle_decl(tree_node*) ../../gcc-source-trunk/gcc/cp/mangle.c:3607 0x10605b0 decl_assembler_name(tree_node*) ../../gcc-source-trunk/gcc/tree.c:669 0x10b1d68 notice_global_symbol(tree_node*) ../../gcc-source-trunk/gcc/varasm.c:1654 0x9c2149 cgraph_node::finalize_function(tree_node*, bool) ../../gcc-source-trunk/gcc/cgraphunit.c:426 0x81a96f expand_or_defer_fn(tree_node*) ../../gcc-source-trunk/gcc/cp/semantics.c:4223 0x6d4c1a instantiate_decl(tree_node*, int, bool) ../../gcc-source-trunk/gcc/cp/pt.c:22118 0x721842 instantiate_pending_templates(int) ../../gcc-source-trunk/gcc/cp/pt.c:22214 0x764975 c_parse_final_cleanups() ../../gcc-source-trunk/gcc/cp/decl2.c:4600 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions. ---------------------------------------------------------------- template < typename > struct A { using type = int; }; template < typename ... T > using TN = int[sizeof ... (T)]; template < typename ... U > void foo (TN < int, U ..., int, typename U::type ... >&) {} template void foo < A < int >, A < float > > (int (&)[6]);