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

            Bug ID: 127719
           Summary: ICE at -O2/3/s on x86_64-linux-gnu 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: xintong.zhou1 at uwaterloo dot ca
  Target Milestone: ---

Compiler Explorer: https://godbolt.org/z/4oob7rhcf

$ 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 20261003 (experimental) (GCC)
$
$ gcc-trunk -O0 small.c
$ gcc-trunk -O2 small.c
during GIMPLE pass: vrp
small.c: In function ā€˜c’:
small.c:3:6: internal compiler error: Segmentation fault
    3 | void c() {
      |      ^
0x266198f internal_error(char const*, ...)
       
/data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x10874d9 crash_signal(int)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/toplev.cc:325
0x7f4a6114251f ???
        ./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x14be151 gimple_bb(gimple const*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple.h:1919
0x14be151 dom_oracle::nearest_relations(tree_node*, basic_block_def*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1842
0x14be6fb dom_oracle::expand_frontier(dom_oracle::frontier_element,
basic_block_def*, relation_kind_t&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:1966
0x14beb1d dom_oracle::relation_search(basic_block_def*, tree_node*, bitmap_head
const*, tree_node*, bitmap_head const*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:2061
0x14bed97 dom_oracle::query(basic_block_def*, tree_node*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-relation.cc:2129
0xc3799d 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:841
0xc35655 fold_using_range::fold_stmt(vrange&, gimple*, fur_source&, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-fold.cc:706
0xc2aa50 gimple_ranger::fold_range_internal(vrange&, gimple*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:303
0xc2aa50 gimple_ranger::range_of_stmt(vrange&, gimple*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:367
0xc2a031 gimple_ranger::range_on_entry(vrange&, basic_block_def*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:186
0x1422974 remove_unreachable::remove_and_update_globals()
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-vrp.cc:330
0x14263bf execute_ranger_vrp(function*, bool)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-vrp.cc:1091
0x1426c60 (anonymous namespace)::pass_vrp::execute(function*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/tree-vrp.cc:1334
/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 -O2 -o /tmp/ccmqZLbg.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
unsigned short a;
unsigned b;
void c() {
  char d = b;
  long e = b + (a & 5ull) & 1;
  if ((unsigned long)b - 2 + e)
    if (e)
      __builtin_unreachable();
  do {
    d >>= e;
    if (d)
      break;
  } while (1);
}
int main() {}

Reply via email to