https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88983
Bug ID: 88983 Summary: ICE in label_matches, at cp/constexpr.c:4035 Product: gcc Version: 6.0 Status: UNCONFIRMED Keywords: ice-on-valid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: asolokha at gmx dot com Target Milestone: --- g++-9.0.0-alpha20190120 snapshot (r268107), 8.2, 7.4, 6.3 ICE when compiling the following testcase reduced from test/SemaCXX/constant-expression-cxx1y.cpp from the clang 7.0.1 testsuite: constexpr int ni (int ay) { switch (ay) { if (1) { case 1: return 1; } else { default: ; } } return 0; } static_assert (ni (1), ""); % g++-9.0.0-alpha20190120 -c xd96vus4.cpp xd96vus4.cpp:21:19: in 'constexpr' expansion of 'ni(1)' xd96vus4.cpp:21:27: internal compiler error: in label_matches, at cp/constexpr.c:4035 21 | static_assert (ni (1), ""); | ^ 0x5cde7e label_matches /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4035 0x8cc336 cxx_eval_constant_expression /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4223 0x8cc53c cxx_eval_constant_expression /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4484 0x8ccd7f cxx_eval_switch_expr /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4148 0x8ccd7f cxx_eval_constant_expression /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4938 0x8cce62 cxx_eval_statement_list /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4073 0x8cce62 cxx_eval_constant_expression /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4836 0x8cba23 cxx_eval_call_expression /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:1799 0x8cc800 cxx_eval_constant_expression /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:4357 0x8d2672 cxx_eval_outermost_constant_expr /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:5095 0x8d2dc8 maybe_constant_value(tree_node*, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/constexpr.c:5327 0x8e5265 cp_fully_fold(tree_node*) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/cp-gimplify.c:2163 0xa63fa4 cp_build_binary_op(op_location_t const&, tree_code, tree_node*, tree_node*, int) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/typeck.c:5538 0xa66aac build_binary_op(unsigned int, tree_code, tree_node*, tree_node*, bool) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/typeck.c:4246 0xa66b2b cp_truthvalue_conversion(tree_node*) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/typeck.c:5864 0x8e9d8d ocp_convert(tree_node*, tree_node*, int, int, int) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/cvt.c:844 0x8eb37d cp_convert(tree_node*, tree_node*, int) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/cvt.c:637 0x8eb37d cp_convert_and_check(tree_node*, tree_node*, int) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/cvt.c:656 0x896934 convert_like_real /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/call.c:7327 0x897af0 perform_implicit_conversion_flags(tree_node*, tree_node*, int, int) /var/tmp/portage/sys-devel/gcc-9.0.0_alpha20190120/work/gcc-9-20190120/gcc/cp/call.c:11043