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

            Bug ID: 109652
           Summary: [14 Regression] ICE on valgrind-3.20.0: in
                    modify_expression, at ipa-param-manipulation.cc:1866
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: ipa
          Assignee: unassigned at gcc dot gnu.org
          Reporter: slyfox at gcc dot gnu.org
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---

Got the ICE on valgrind-3.20.0 against today's gcc master (
r14-300-g65369ab62cee68 ). Minimal reproducer:

// $ cat bug.c.c
typedef int UInt;
UInt skeletal_RI5_instr;
__attribute__((__noreturn__)) void vex_assert_fail();
typedef struct {
  union {
    struct {
      UInt imm5;
    } I5;
  } ARMri5;
} ARMRI5;
typedef enum { ARMin_Alu, ARMin_Shift } ARMInstrTag;
void iregEnc();
static UInt skeletal_RI5(ARMRI5 *ri) {
  UInt imm5 = ri->ARMri5.I5.imm5;
  __builtin_expect(imm5, 1) ?: vex_assert_fail();
  iregEnc(ri->ARMri5);
  return skeletal_RI5_instr;
}
ARMInstrTag emit_ARMInstr_i_0;
void *emit_ARMInstr_disp_cp_chain_me_to_slowEP() {
  switch (emit_ARMInstr_i_0) {
  case ARMin_Alu:
    UInt instr, subopc;
    UInt rD, rN;
    goto bad;
    instr |= subopc | rN;
  case ARMin_Shift:
    rD = 0;
    UInt rM = 0;
    ARMRI5 argR;
    instr = skeletal_RI5(&argR);
    instr |= rD | rM;
    goto done;
  }
bad:
done:
  return 0;
}

Crashing:

$ gcc  -O2  -c bug.c.c -o bug.o
during IPA pass: inline
In function 'skeletal_RI5.isra':
cc1: internal compiler error: in modify_expression, at
ipa-param-manipulation.cc:1866
0x69367d ipa_param_body_adjustments::modify_expression(tree_node**, bool,
gimple**)
        ../../source/gcc/ipa-param-manipulation.cc:1866
0xa7f038 ipa_param_body_adjustments::modify_call_stmt(gcall**, gimple*)
        ../../source/gcc/ipa-param-manipulation.cc:2165
0xcfd246 remap_gimple_stmt
        ../../source/gcc/tree-inline.cc:1961
0xd003f8 copy_bb
        ../../source/gcc/tree-inline.cc:2056
0xd0171f copy_cfg_body
        ../../source/gcc/tree-inline.cc:3069
0xd0171f copy_body
        ../../source/gcc/tree-inline.cc:3322
0xd0424a tree_function_versioning(tree_node*, tree_node*, vec<ipa_replace_map*,
va_gc, vl_embed>*, ipa_param_adjustments*, bool, bitmap_head*,
basic_block_def*)
        ../../source/gcc/tree-inline.cc:6347
0x852aae cgraph_node::materialize_clone()
        ../../source/gcc/cgraphclones.cc:1155
0x842f85 cgraph_node::get_untransformed_body()
        ../../source/gcc/cgraph.cc:3992
0xa3ee05 maybe_materialize_called_clones
        ../../source/gcc/ipa-inline-transform.cc:720
0xa40b8b inline_transform(cgraph_node*)
        ../../source/gcc/ipa-inline-transform.cc:777
0xb9796f execute_one_ipa_transform_pass
        ../../source/gcc/passes.cc:2343
0xb9796f execute_all_ipa_transforms(bool)
        ../../source/gcc/passes.cc:2406
0x84d83f cgraph_node::expand()
        ../../source/gcc/cgraphunit.cc:1834
0x84d83f cgraph_node::expand()
        ../../source/gcc/cgraphunit.cc:1794
0x84ee2a expand_all_functions
        ../../source/gcc/cgraphunit.cc:2024
0x84ee2a symbol_table::compile()
        ../../source/gcc/cgraphunit.cc:2398
0x8513a7 symbol_table::compile()
        ../../source/gcc/cgraphunit.cc:2311
0x8513a7 symbol_table::finalize_compilation_unit()
        ../../source/gcc/cgraphunit.cc:2583

$ gcc -v
Using built-in specs.
COLLECT_GCC=/<<NIX>>/gcc-14.0.0/bin/gcc
COLLECT_LTO_WRAPPER=/<<NIX>>/gcc-14.0.0/libexec/gcc/x86_64-unknown-linux-gnu/14.0.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with:
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 14.0.0 99999999 (experimental) (GCC)

Reply via email to