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

            Bug ID: 125290
           Summary: [16/17 Regression] ICE at -O3 during GIMPLE pass:
                    ifcvt
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xxs_chy at outlook dot com
  Target Milestone: ---

Reproducer: https://godbolt.org/z/619o499cM
Testcase:
#include <stdint.h>
int64_t g21;
_Bool g31, f14f16_c12;
void f14f16()
{
    int16_t v7;
    int64_t v9;
    int64_t v13;
    if (g31)
    {
        g21 = 0;
        switch (v7)
        {
            case 4:
            case 30608: break;
            default: __builtin_unreachable();
        }
    }
    else
    {
    lbl_bf2:
        v9 = g21;
    }
    v13 = v9;
    switch (v13)
    {
        case 80592981658379000:
        case 2: goto lbl_sw12;
        default:
            if (f14f16_c12)
                goto lbl_bf2;
            else
                return;
    }
lbl_sw12:
    __builtin_unreachable();
}

Dump at -O3:
during GIMPLE pass: ifcvt
<source>: In function 'f14f16':
<source>:4:6: internal compiler error: in gimple_switch_label, at gimple.h:4972
    4 | void f14f16()
      |      ^~~~~~
0x2632b88 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x26277cb internal_error(char const*, ...)
        ???:0
0xa29faa fancy_abort(char const*, int, char const*)
        ???:0
0x127a241 tree_if_conversion(loop*, vec<gimple*, va_heap, vl_ptr>*)
        ???:0

Reply via email to