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

            Bug ID: 126197
           Summary: [16 Regression] ICE at -Os during GIMPLE pass: vrp
           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/avzEzx6xh
Testcase:
#include <stdlib.h>
typedef void *(*fp_t_1)();
int32_t g19;
void *f29();
void *f7() { abort(); }
void f12()
{
    int32_t bb0;
    int32_t bb1;
    _Bool c7, c11;
    fp_t_1 fp10;
    bb0 = __builtin_clz(g19);
    switch ((int32_t)bb0)
    case 5015:
    case 309795350:
        goto lbl_bf45;
    fp10 = f7;
lbl_br5:
    if (c7)
    lbl_bf16:
        if (bb1) goto lbl_br5;
    fp10();
    if (c7) __builtin_unreachable();
    fp10 = f29;
    if (c11) return;
lbl_bf45:
    c11 = 1;
    goto lbl_bf16;
}

This testcase crashed GCC with -Os. The dump:
<source>: In function 'f12':
<source>:6:6: internal compiler error: Segmentation fault
    6 | void f12()
      |      ^~~
0x2067238 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x206052b internal_error(char const*, ...)
        ???:0
0x1192b34 execute_ranger_vrp(function*, bool)
        ???:0

Reply via email to