https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103825

            Bug ID: 103825
           Summary: [12 Regression] ICE on switch on enum class in
                    bitfield
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: blubban at gmail dot com
  Target Milestone: ---

enum class Type { Pawn };
struct Piece {
  Type type : 4;
};
void foo() {
  switch (Piece().type)
    case Type::Pawn:;
}


The above causes an ICE on GCC 12.0.0 20211222, no compile flags needed. It
compiles without warnings on GCC 11, Clang, and MSVC.

Compiler Explorer: https://godbolt.org/z/GdG6ovEzz


<source>: In function 'void foo()':
<source>:5:6: error: type precision mismatch in switch statement
    5 | void foo() {
      |      ^~~
switch (retval.0) <default: <D.2160>, case 0: <D.2157>>
<source>:5:6: internal compiler error: 'verify_gimple' failed
0x2115089 internal_error(char const*, ...)
        ???:0
0x11603ed verify_gimple_in_seq(gimple*)
        ???:0
0xdda0d1 gimplify_body(tree_node*, bool)
        ???:0
0xdda397 gimplify_function_tree(tree_node*)
        ???:0
0xbe6a57 cgraph_node::analyze()
        ???:0
0xbeaf6d symbol_table::finalize_compilation_unit()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

Reply via email to