https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77626
Bug ID: 77626 Summary: ICE with -Wall on x86_64-linux-gnu (internal compiler error: Segmentation fault, byte_from_pos, cxx_fold_indirect_ref) Product: gcc Version: 7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: chengniansun at gmail dot com Target Milestone: --- $ 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 20160916 (experimental) [trunk revision 240207] (GCC) $ $ g++-trunk -Wall small.C small.C:2:18: error: field ‘aligned’ has incomplete type ‘struct2’ struct struct2 aligned; ^~~~~~~ small.C:2:10: note: forward declaration of ‘struct struct2’ struct struct2 aligned; ^~~~~~~ small.C: In function ‘void fn1(int)’: small.C:6:15: internal compiler error: Segmentation fault fn1((int &)a); ^ 0xdc7baf crash_signal ../../gcc-source-trunk/gcc/toplev.c:336 0xdb6a3c byte_from_pos(tree_node*, tree_node*) ../../gcc-source-trunk/gcc/stor-layout.c:862 0x895eac cxx_fold_indirect_ref ../../gcc-source-trunk/gcc/cp/constexpr.c:2897 0x89e8f0 cxx_eval_indirect_ref ../../gcc-source-trunk/gcc/cp/constexpr.c:3029 0x89e8f0 cxx_eval_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:3903 0x8a46df cxx_eval_outermost_constant_expr ../../gcc-source-trunk/gcc/cp/constexpr.c:4382 0x8a79cc maybe_constant_value_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:4576 0x8a79cc maybe_constant_value(tree_node*, tree_node*) ../../gcc-source-trunk/gcc/cp/constexpr.c:4600 0x65704a build_over_call ../../gcc-source-trunk/gcc/cp/call.c:7766 0x662c4f build_new_function_call(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, int) ../../gcc-source-trunk/gcc/cp/call.c:4190 0x8062d8 finish_call_expr(tree_node*, vec<tree_node*, va_gc, vl_embed>**, bool, bool, int) ../../gcc-source-trunk/gcc/cp/semantics.c:2440 0x77d54b cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6937 0x77b972 cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8019 0x785877 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8696 0x785e43 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8798 0x786733 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9086 0x789069 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9253 0x78968f cp_parser_expression_statement ../../gcc-source-trunk/gcc/cp/parser.c:10736 0x797f3a cp_parser_statement ../../gcc-source-trunk/gcc/cp/parser.c:10587 0x798e35 cp_parser_statement_seq_opt ../../gcc-source-trunk/gcc/cp/parser.c:10859 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. $ $ g++-trunk small.C small.C:2:18: error: field ‘aligned’ has incomplete type ‘struct2’ struct struct2 aligned; ^~~~~~~ small.C:2:10: note: forward declaration of ‘struct struct2’ struct struct2 aligned; ^~~~~~~ $ $ cat small.C struct A { struct struct2 aligned; }; void fn1(int) { A a; fn1((int &)a); }