trippels@gcc2-power8 generic % cat nsLineLayout.ii enum class A { foo }; void fn1(const A test) { switch (test) case A::foo: ; } trippels@gcc2-power8 generic % g++ -c nsLineLayout.ii nsLineLayout.ii: In function ‘void fn1(A)’: nsLineLayout.ii:4:11: internal compiler error: tree check: expected integer_cst, have nop_expr in get_val, at tree.h:5157 case A::foo: ; ^~~ 0x10d9ee93 tree_check_failed(tree_node const*, char const*, int, char const*, ...) ../../gcc/gcc/tree.c:9587 0x10120d9b tree_int_cst_elt_check ../../gcc/gcc/tree.h:3144 0x104a9c8f tree_int_cst_elt_check ../../gcc/gcc/tree.h:3147 0x104a9c8f wi::extended_tree<192>::get_val() const ../../gcc/gcc/tree.h:5157 0x104a9c8f wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<192> > const&) ../../gcc/gcc/wide-int.h:898 0x104a9c8f wide_int_ref_storage<generic_wide_int<wi::extended_tree<192> > > ../../gcc/gcc/wide-int.h:945 0x104a9c8f generic_wide_int<generic_wide_int<wi::extended_tree<192> > > ../../gcc/gcc/wide-int.h:722 0x104a9c8f lts_p<generic_wide_int<wi::extended_tree<192> >, generic_wide_int<wi::extended_tree<192> > > ../../gcc/gcc/wide-int.h:1749 0x104a9c8f tree_int_cst_lt ../../gcc/gcc/tree.h:5217 0x104a9c8f c_add_case_label(unsigned int, splay_tree_s*, tree_node*, tree_node*, tree_node*, tree_node*, bool*) ../../gcc/gcc/c-family/c-common.c:6592 0x1019f217 finish_case_label(unsigned int, tree_node*, tree_node*) ../../gcc/gcc/cp/decl.c:3417 0x102fb753 cp_parser_label_for_labeled_statement ../../gcc/gcc/cp/parser.c:10259 0x102e4ca3 cp_parser_statement ../../gcc/gcc/cp/parser.c:10132 0x1031e23b cp_parser_implicitly_scoped_statement ../../gcc/gcc/cp/parser.c:11557 0x102e56d3 cp_parser_selection_statement ../../gcc/gcc/cp/parser.c:10632 0x102e56d3 cp_parser_statement ../../gcc/gcc/cp/parser.c:10040 0x102e6617 cp_parser_statement_seq_opt ../../gcc/gcc/cp/parser.c:10456 0x102e67ef cp_parser_compound_statement ../../gcc/gcc/cp/parser.c:10410 0x1031325b cp_parser_function_body ../../gcc/gcc/cp/parser.c:20225 0x1031325b cp_parser_ctor_initializer_opt_and_function_body ../../gcc/gcc/cp/parser.c:20261
*** Bug 68364 has been marked as a duplicate of this bug. ***
Started with the delayed folding merge: r230365.
*** Bug 68368 has been marked as a duplicate of this bug. ***
*** Bug 68359 has been marked as a duplicate of this bug. ***
The problem here is that check_case_bounds is getting NOP_EXPRs: (const A) 0 introduced in convert_and_check called in c_add_case_label, and then it tries tree_int_cst_compare on that, oops. STRIP_NOPS-ing case_low and case_high would fix this...
Author: mpolacek Date: Mon Nov 16 20:16:57 2015 New Revision: 230435 URL: https://gcc.gnu.org/viewcvs?rev=230435&root=gcc&view=rev Log: PR c++/68362 * c-common.c (check_case_bounds): Fold low and high cases. * g++.dg/delayedfold/switch-1.C: New test. Added: trunk/gcc/testsuite/g++.dg/delayedfold/switch-1.C Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.c trunk/gcc/testsuite/ChangeLog
Should be fixed now.