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

            Bug ID: 126329
           Summary: [14-17 Regression] ICE at -O2 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/KGx6eschq
Testcase:
#include <stdint.h>
int32_t g30;
void f25(int32_t a1)
{
    int a2;
    _Bool c6, c14;
    int8_t v8;
    int64_t v15;
    int8_t v16;
    if (a1 == 8098) goto lbl_sw11;
    a2 = __builtin_ffs(a1);
lbl_b8:
    v8 = a2;
    c6 = v8 >= v16;
    goto lbl_br26;
lbl_sw11:
lbl_br17:
    goto lbl_b8;
lbl_br26:
    g30 = v8;
    if (c6) __builtin_unreachable();
    c6 = c14 = a1;
    a1 = v8;
    if (v15) goto lbl_br26;
    if (c14) goto lbl_br17;
}

Dump at -O2:
during GIMPLE pass: vrp
<source>: In function 'f25':
<source>:3:6: internal compiler error: Segmentation fault
    3 | void f25(int32_t a1)
      |      ^~~
0x27bc168 diagnostics::context::diagnostic_impl(rich_location*,
diagnostics::metadata const*, diagnostics::option_id, char const*,
__va_list_tag (*) [1], diagnostics::kind)
        ???:0
0x27b0dab internal_error(char const*, ...)
        ???:0
0x1317c4e instantiate_scev(edge_def*, loop*, tree_node*)
        ???:0
0x1316c84 analyze_scalar_evolution(loop*, tree_node*)
        ???:0
0x1316d1a analyze_scalar_evolution(loop*, tree_node*)
        ???:0
0x162e820 range_of_var_in_loop(vrange&, tree_node*, loop*, gimple*,
range_query*)
        ???:0
0xe36cab fold_using_range::range_of_ssa_name_with_loop_info(vrange&,
tree_node*, loop*, gphi*, fur_source&)
        ???:0
0xe37357 fold_using_range::range_of_phi(vrange&, gphi*, fur_source&)
        ???:0
0xe3b470 fold_using_range::fold_stmt(vrange&, gimple*, fur_source&, tree_node*)
        ???:0
0xe27d4e gimple_ranger::register_inferred_ranges(gimple*)
        ???:0
0x15893c8 rvrp_folder::pre_fold_bb(basic_block_def*)
        ???:0
0x1424b08 substitute_and_fold_dom_walker::before_dom_children(basic_block_def*)
        ???:0
0x249c767 dom_walker::walk(basic_block_def*)
        ???:0
0x14236cb substitute_and_fold_engine::substitute_and_fold(basic_block_def*)
        ???:0
0x1586750 execute_ranger_vrp(function*, bool)
        ???:0

Reply via email to