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

            Bug ID: 126846
           Summary: ICE at -O3 on x86_64-linux-gnu during GIMPLE pass: vrp
                    in create_relation_in_bb, at value-relation.cc:1217
           Product: gcc
           Version: 17.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xintong.zhou1 at uwaterloo dot ca
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/7EM9Wo56f

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=/data/x27zhou/compiler-nightly/install/gcc/bin/gcc
COLLECT_LTO_WRAPPER=/data/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /data/x27zhou/compiler-nightly/src/gcc/configure CC='ccache
clang' CXX='ccache clang++' --enable-checking=yes --disable-bootstrap
--disable-multilib --enable-languages=c,c++
--prefix=/data/x27zhou/compiler-nightly/install/gcc
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 17.0.0 20260813 (experimental) (GCC)
$
$ gcc-trunk -O0 small.c
$
$ gcc-trunk -O3 small.c
during GIMPLE pass: vrp
small.c: In function ā€˜i’:
small.c:11:5: internal compiler error: in create_relation_in_bb, at
value-relation.cc:1218
   11 | int i() {
      |     ^
0x25d171f internal_error(char const*, ...)
       
/data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x25da55f fancy_abort(char const*, int, char const*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostics/context.cc:1813
0x14a366c dom_oracle::create_relation_in_bb(basic_block_def*, relation_kind_t,
tree_node*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1217
0x14a2cb2 dom_oracle::search_and_merge_relation(basic_block_def*,
relation_kind_t, tree_node*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1268
0x14a3033 dom_oracle::register_transitives(basic_block_def*, value_relation
const&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1367
0x14a2b93 dom_oracle::record(basic_block_def*, relation_kind_t, tree_node*,
tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1182
0x14a27ea relation_oracle::record(gimple*, relation_kind_t, tree_node*,
tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1118
0xc2b13d fur_depend::register_relation(gimple*, relation_kind_t, tree_node*,
tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-fold.cc:181
0xc2db0b fold_using_range::range_of_range_op(vrange&, gimple_range_op_handler&,
fur_source&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-fold.cc:861
0xc2b5ce fold_using_range::fold_stmt(vrange&, gimple*, fur_source&, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-fold.cc:698
0xc20d50 gimple_ranger::fold_range_internal(vrange&, gimple*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:303
0xc20d50 gimple_ranger::prefill_stmt_dependencies(tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:494
0xc2081d gimple_ranger::range_of_stmt(vrange&, gimple*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:363
0xc1fe51 gimple_ranger::range_on_entry(vrange&, basic_block_def*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:186
0xc200eb gimple_ranger::range_on_exit(vrange&, basic_block_def*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:231
0xc20494 gimple_ranger::range_on_edge(vrange&, edge_def*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:279
0x21bd996 phi_analyzer::process_phi(gphi*, range_query&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-phi.cc:485
0x21bcd9b phi_analyzer::phi_analyzer(range_query&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-phi.cc:301
0x21bbca5 phi_analysis(range_query&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-phi.cc:47
0x140e07c execute_ranger_vrp(function*, bool)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-vrp.cc:1094
/data/x27zhou/compiler-nightly/install/gcc/libexec/gcc/x86_64-pc-linux-gnu/17.0.0/cc1
-quiet -imultiarch x86_64-linux-gnu small.c -quiet -dumpdir a- -dumpbase
small.c -dumpbase-ext .c -mtune=generic -march=x86-64 -O3 -o /tmp/ccjdXTRZ.s
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
$
$ cat small.c
short a;
int b;
unsigned c;
long d;
int e(int f, int g) {
  if (g != f)
    return g / f;
  return 4;
}
int h(int f, int g) { return e(f, g); }
int i() {
  long j = 9;
  c = a & 7;
  while (d < (int)c + b + c) {
    j = (int)c + (h(b + 615227, a) + b + (int)c) - j;
    d++;
  }
  return j;
}
int main() {}

Reply via email to