https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71058
Bug ID: 71058 Summary: ICE when building heavy templating and -std=c++17 -gstabs Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: vapier at gcc dot gnu.org CC: toolchain at gentoo dot org Target Milestone: --- Target: x86_64-linux-gnu when compiling this small test case, gcc-5+ crashes. not a regression since it requires -std=c++17 which is new to gcc-5. $ cat test.ii enum VkPipelineBindPoint {}; template <typename> struct A; template <VkPipelineBindPoint> struct B; template <> struct A<int> { template <VkPipelineBindPoint P> static auto a = B<P>::func; }; $ g++-5.3.0 -c test.ii -gstabs -std=c++17 test.ii:4:20: internal compiler error: Segmentation fault template <> struct A<int> { ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.gentoo.org/> for instructions. $ gdb --args g++-5.3.0 -c test.ii -gstabs -std=c++17 (gdb) set follow-fork-mode child (gdb) run Starting program: /usr/bin/g++-5.3.0 -c test.ii -gstabs -std=c++17 [New process 25621] process 25621 is executing new program: /usr/libexec/gcc/x86_64-pc-linux-gnu/5.3.0/cc1plus Thread 2.1 "cc1plus" received signal SIGSEGV, Segmentation fault. [Switching to process 25621] 0x0000000000d071a3 in safe_uhwi (val=val@entry=0x7ffff68a13f8, len=len@entry=0x0, i=<optimized out>) at .../gcc-5.3.0/gcc/wide-int.cc:85 85 .../gcc-5.3.0/gcc/wide-int.cc: No such file or directory. (gdb) bt #0 0x0000000000d071a3 in safe_uhwi (val=val@entry=0x7ffff68a13f8, len=len@entry=0x0, i=<optimized out>) at .../gcc-5.3.0/gcc/wide-int.cc:85 #1 0x0000000000d09cb3 in safe_uhwi (i=<optimized out>, len=0x0, val=0x7ffff68a13f8) at .../gcc-5.3.0/gcc/wide-int.cc:85 #2 wi::lshift_large (val=val@entry=0x7fffffffc250, xval=0x7ffff68a13f8, xlen=0x0, precision=precision@entry=0x80, shift=shift@entry=0x3) at .../gcc-5.3.0/gcc/wide-int.cc:1917 #3 0x00000000007eae41 in wi::lshift<generic_wide_int<wi::extended_tree<128> >, int> (y=<optimized out>, x=...) at .../gcc-5.3.0/gcc/wide-int.h:2860 #4 int_bit_position (field=0x7ffff68a0280, field=0x7ffff68a0280) at .../gcc-5.3.0/gcc/tree.h:5079 #5 dbxout_type_fields (type=<optimized out>) at .../gcc-5.3.0/gcc/dbxout.c:1546 #6 dbxout_type (type=<optimized out>, type@entry=0x7ffff689ec78, full=<optimized out>, full@entry=0x1) at .../gcc-5.3.0/gcc/dbxout.c:2223 #7 0x00000000007ed437 in dbxout_symbol (decl=0x7ffff689a720, local=<optimized out>) at .../gcc-5.3.0/gcc/dbxout.c:2795 #8 0x0000000000a33d56 in rest_of_type_compilation (type=type@entry=0x7ffff689ec78, toplev=0x1) at .../gcc-5.3.0/gcc/passes.c:309 #9 0x0000000000663b50 in finish_struct_1 (t=0x7ffff689ec78) at .../gcc-5.3.0/gcc/cp/class.c:6742 #10 0x000000000066484d in finish_struct (t=t@entry=0x7ffff689ec78, attributes=0x0) at .../gcc-5.3.0/gcc/cp/class.c:6908 #11 0x0000000000682506 in cp_parser_class_specifier_1 (parser=0x7ffff68a0000) at .../gcc-5.3.0/gcc/cp/parser.c:19880 #12 cp_parser_class_specifier (parser=0x7ffff68a0000) at .../gcc-5.3.0/gcc/cp/parser.c:20108 #13 cp_parser_type_specifier (parser=parser@entry=0x7ffff68a0000, flags=flags@entry=0x1, decl_specs=decl_specs@entry=0x7fffffffc6f0, is_declaration=is_declaration@entry=0x1, declares_class_or_enum=declares_class_or_enum@entry=0x7fffffffc684, is_cv_qualifier=is_cv_qualifier@entry=0x7fffffffc683) at .../gcc-5.3.0/gcc/cp/parser.c:14727 #14 0x0000000000697de0 in cp_parser_decl_specifier_seq (parser=parser@entry=0x7ffff68a0000, flags=flags@entry=0x1, decl_specs=decl_specs@entry=0x7fffffffc6f0, declares_class_or_enum=declares_class_or_enum@entry=0x7fffffffc6ec) at .../gcc-5.3.0/gcc/cp/parser.c:11958 #15 0x000000000069ceed in cp_parser_single_declaration (parser=parser@entry=0x7ffff68a0000, checks=checks@entry=0x0, member_p=member_p@entry=0x0, explicit_specialization_p=explicit_specialization_p@entry=0x1, friend_p=friend_p@entry=0x0) at .../gcc-5.3.0/gcc/cp/parser.c:23776 #16 0x000000000069d8a9 in cp_parser_explicit_specialization (parser=parser@entry=0x7ffff68a0000) at .../gcc-5.3.0/gcc/cp/parser.c:14623 #17 0x000000000067f9b0 in cp_parser_declaration (parser=parser@entry=0x7ffff68a0000) at .../gcc-5.3.0/gcc/cp/parser.c:11332 #18 0x00000000006a703b in cp_parser_declaration_seq_opt (parser=parser@entry=0x7ffff68a0000) at .../gcc-5.3.0/gcc/cp/parser.c:11265 #19 0x00000000006a7392 in cp_parser_translation_unit (parser=0x7ffff68a0000) at .../gcc-5.3.0/gcc/cp/parser.c:4100 #20 c_parse_file () at .../gcc-5.3.0/gcc/cp/parser.c:33229 #21 0x000000000075f0ba in c_common_parse_file () at .../gcc-5.3.0/gcc/c-family/c-opts.c:1057 #22 0x0000000000ae1331 in compile_file () at .../gcc-5.3.0/gcc/toplev.c:594 #23 0x00000000005e7cb0 in do_compile () at .../gcc-5.3.0/gcc/toplev.c:2067 #24 toplev::main (this=this@entry=0x7fffffffc920, argc=argc@entry=0xf, argv=argv@entry=0x7fffffffca28) at .../gcc-5.3.0/gcc/toplev.c:2165 #25 0x00000000005e8a1e in main (argc=0xf, argv=0x7fffffffca28) at .../gcc-5.3.0/gcc/main.c:39