https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70386
Bug ID: 70386 Summary: ICE with -Wall on valid code on x86_64-linux-gnu in verify_ctor_sanity, at cp/constexpr.c:2232 Product: gcc Version: 6.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 code causes an ICE when compiled with the current GCC trunk with -Wall on x86_64-linux-gnu in both 32-bit and 64-bit modes. This is a regression from 5.3.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/6.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 6.0.0 20160323 (experimental) [trunk revision 234418] (GCC) $ $ g++-trunk small.cpp $ g++-5.3 -Wall small.cpp $ $ g++-trunk -Wall small.cpp small.cpp: In function ‘int main()’: small.cpp:14:20: internal compiler error: in verify_ctor_sanity, at cp/constexpr.c:2232 return (cp () == d); ^ 0x845875 verify_ctor_sanity ../../gcc-source-trunk/gcc/cp/constexpr.c:2232 0x852643 cxx_eval_bare_aggregate ../../gcc-source-trunk/gcc/cp/constexpr.c:2257 0x84d924 cxx_eval_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:3699 0x851fa9 cxx_eval_component_reference ../../gcc-source-trunk/gcc/cp/constexpr.c:1954 0x84e2dc cxx_eval_constant_expression ../../gcc-source-trunk/gcc/cp/constexpr.c:3670 0x8538f9 cxx_eval_outermost_constant_expr ../../gcc-source-trunk/gcc/cp/constexpr.c:3947 0x8565bc maybe_constant_value_1 ../../gcc-source-trunk/gcc/cp/constexpr.c:4135 0x8565bc maybe_constant_value(tree_node*, tree_node*) ../../gcc-source-trunk/gcc/cp/constexpr.c:4156 0x779c36 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/typeck.c:5096 0x77b747 cp_build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, int) ../../gcc-source-trunk/gcc/cp/typeck.c:4729 0x623d3a build_new_op_1 ../../gcc-source-trunk/gcc/cp/call.c:5782 0x624d4e build_new_op(unsigned int, tree_code, int, tree_node*, tree_node*, tree_node*, tree_node**, int) ../../gcc-source-trunk/gcc/cp/call.c:5827 0x766322 build_x_binary_op(unsigned int, tree_code, tree_node*, tree_code, tree_node*, tree_code, tree_node**, int) ../../gcc-source-trunk/gcc/cp/typeck.c:3866 0x740946 cp_parser_binary_expression ../../gcc-source-trunk/gcc/cp/parser.c:8923 0x7410a0 cp_parser_assignment_expression ../../gcc-source-trunk/gcc/cp/parser.c:9055 0x743979 cp_parser_expression ../../gcc-source-trunk/gcc/cp/parser.c:9222 0x73504e cp_parser_primary_expression ../../gcc-source-trunk/gcc/cp/parser.c:4878 0x736816 cp_parser_postfix_expression ../../gcc-source-trunk/gcc/cp/parser.c:6690 0x73f95c cp_parser_unary_expression ../../gcc-source-trunk/gcc/cp/parser.c:7988 0x7401b7 cp_parser_cast_expression ../../gcc-source-trunk/gcc/cp/parser.c:8665 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. $ --------------------------------------- struct A { void f () {} }; struct B : public A {}; struct C : public A {}; struct D : public B, public C {}; typedef void (C::*cp) (); typedef void (D::*dp) (); int main () { cp c = &A::f; dp d = c; return (cp () == d); }