https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84578
Bug ID: 84578 Summary: [6/7/8 Regression] ICE with flexible array member and constexpr Product: gcc Version: 8.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: reichelt at gcc dot gnu.org Target Milestone: --- The following (valid?) code snippet triggers an ICE since GCC 6.1.0: ====================================== struct A { constexpr A() : i(), x() {} int i; char x[]; }; A a; ====================================== bug.cc:8:3: in 'constexpr' expansion of 'a.A::A()' bug.cc:8:3: internal compiler error: in tree_to_uhwi, at tree.c:6817 A a; ^ 0x78c097 tree_to_uhwi(tree_node const*) ../../gcc/gcc/tree.c:6817 0x85630b cxx_eval_vec_init_1 ../../gcc/gcc/cp/constexpr.c:2891 0x8523c5 cxx_eval_vec_init ../../gcc/gcc/cp/constexpr.c:3011 0x8523c5 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4535 0x854c7d cxx_eval_store_expression ../../gcc/gcc/cp/constexpr.c:3685 0x85232f cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4248 0x8528cf cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4552 0x8513f7 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4296 0x8513f7 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4296 0x852021 cxx_eval_statement_list ../../gcc/gcc/cp/constexpr.c:3898 0x852021 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4643 0x85138d cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4647 0x852021 cxx_eval_statement_list ../../gcc/gcc/cp/constexpr.c:3898 0x852021 cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4643 0x85080f cxx_eval_call_expression ../../gcc/gcc/cp/constexpr.c:1689 0x8513ab cxx_eval_constant_expression ../../gcc/gcc/cp/constexpr.c:4170 0x8569f7 cxx_eval_outermost_constant_expr ../../gcc/gcc/cp/constexpr.c:4819 0x859988 maybe_constant_init_1 ../../gcc/gcc/cp/constexpr.c:5145 0x8cceaa expand_default_init ../../gcc/gcc/cp/init.c:1901 0x8cceaa expand_aggr_init_1 ../../gcc/gcc/cp/init.c:2004 Please submit a full bug report, [etc.] The code was accepted by GCC 4.5, 4.6, 4.7, 5. It also triggered an ICE with GCC 4.8, 4.9.