Created attachment 39010 [details] Preprocessed output as created by -freport-bug /home/jamrial/range-v3/include/range/v3/utility/box.hpp:198:14: internal compiler error: Segmentation fault {} ^ 0xd6e91f crash_signal /home/jamrial/gcc-svn/gcc/toplev.c:335 0x86e332 cx_check_missing_mem_inits /home/jamrial/gcc-svn/gcc/cp/constexpr.c:740 0x87def1 cx_check_missing_mem_inits /home/jamrial/gcc-svn/gcc/hash-table.h:906 0x87def1 register_constexpr_fundef(tree_node*, tree_node*) /home/jamrial/gcc-svn/gcc/cp/constexpr.c:800 0x67a190 maybe_save_function_definition /home/jamrial/gcc-svn/gcc/cp/decl.c:14619 0x67a190 finish_function(int) /home/jamrial/gcc-svn/gcc/cp/decl.c:14744 0x6aa5d6 instantiate_decl(tree_node*, int, bool) /home/jamrial/gcc-svn/gcc/cp/pt.c:22170 0x7330ac mark_used(tree_node*, int) /home/jamrial/gcc-svn/gcc/cp/decl2.c:5290 0x63f4f0 build_over_call /home/jamrial/gcc-svn/gcc/cp/call.c:7818 0x64af0f build_new_method_call_1 /home/jamrial/gcc-svn/gcc/cp/call.c:8543 0x64af0f build_new_method_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, tree_node**, int) /home/jamrial/gcc-svn/gcc/cp/call.c:8613 0x64be95 build_special_member_call(tree_node*, tree_node*, vec<tree_node*, va_gc, vl_embed>**, tree_node*, int, int) /home/jamrial/gcc-svn/gcc/cp/call.c:8139 0x7bfa06 expand_default_init /home/jamrial/gcc-svn/gcc/cp/init.c:1748 0x7bfa06 expand_aggr_init_1 /home/jamrial/gcc-svn/gcc/cp/init.c:1863 0x7c66a0 emit_mem_initializers(tree_node*) /home/jamrial/gcc-svn/gcc/cp/init.c:1166 0x6afcc3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/jamrial/gcc-svn/gcc/cp/pt.c:15222 0x6ad89a tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) /home/jamrial/gcc-svn/gcc/cp/pt.c:15401 0x6aa52b instantiate_decl(tree_node*, int, bool) /home/jamrial/gcc-svn/gcc/cp/pt.c:22148 0x7330ac mark_used(tree_node*, int) /home/jamrial/gcc-svn/gcc/cp/decl2.c:5290 0x63f4f0 build_over_call /home/jamrial/gcc-svn/gcc/cp/call.c:7818 Make sure to compile the preprocessed source with -Wall or it will not trigger the ICE.
Confirmed. Reducing...
Created attachment 39020 [details] Somewhat reduced testcase Thread 2.1 "cc1plus" received signal SIGSEGV, Segmentation fault. [Switching to process 24708] cx_check_missing_mem_inits (fun=<optimized out>, body=0x3fffaf688268, complain=<optimized out>) at ../../gcc/gcc/cp/constexpr.c:740 740 if (TREE_CODE (field) != FIELD_DECL (gdb) p field $1 = (tree) 0x0 Unfortunately reducing the testcase takes ages.
Created attachment 39023 [details] reduced testcase
Started with r238688.
Since the patch was backported to gcc-6 branch immediately, gcc-6 is also affected.
So, perhaps simply: diff --git a/gcc/cp/constexpr.c b/gcc/cp/constexpr.c index 6bcb41a..83fd9a4 100644 --- a/gcc/cp/constexpr.c +++ b/gcc/cp/constexpr.c @@ -734,7 +734,7 @@ cx_check_missing_mem_inits (tree fun, tree body, bool complain) || DECL_ARTIFICIAL (index)) continue; } - for (; field != index; field = DECL_CHAIN (field)) + for (; field != NULL_TREE && field != index; field = DECL_CHAIN (field)) { tree ftype; if (TREE_CODE (field) != FIELD_DECL
Reduced: template <typename Element> struct box { Element value; constexpr box() : value{} {} }; struct B: box<int> { }; template box<B>::box();
Author: jason Date: Fri Jul 29 14:03:26 2016 New Revision: 238867 URL: https://gcc.gnu.org/viewcvs?rev=238867&root=gcc&view=rev Log: PR c++/72457 - ICE with list-value-initialized base. * init.c (expand_aggr_init_1): Only handle value-init of bases. * constexpr.c (build_data_member_initialization): Handle multiple initializers for the same field. Added: trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-list1.C Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/constexpr.c trunk/gcc/cp/init.c
Author: jason Date: Fri Jul 29 14:08:03 2016 New Revision: 238868 URL: https://gcc.gnu.org/viewcvs?rev=238868&root=gcc&view=rev Log: PR c++/72457 - ICE with list-value-initialized base. * init.c (expand_aggr_init_1): Only handle value-init of bases. * constexpr.c (build_data_member_initialization): Handle multiple initializers for the same field. Added: branches/gcc-6-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-list1.C Modified: branches/gcc-6-branch/gcc/cp/ChangeLog branches/gcc-6-branch/gcc/cp/constexpr.c branches/gcc-6-branch/gcc/cp/init.c
Fixed.
Author: jason Date: Mon Sep 18 18:33:58 2017 New Revision: 252938 URL: https://gcc.gnu.org/viewcvs?rev=252938&root=gcc&view=rev Log: PR c++/72457 - ICE with list-value-initialized base. * init.c (expand_aggr_init_1): Only handle value-init of bases. * constexpr.c (build_data_member_initialization): Handle multiple initializers for the same field. Added: branches/gcc-5-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-list1.C Modified: branches/gcc-5-branch/gcc/cp/ChangeLog branches/gcc-5-branch/gcc/cp/constexpr.c branches/gcc-5-branch/gcc/cp/init.c