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

            Bug ID: 126648
           Summary: ICE at -O3 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/avzj6P7Mn

$ 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
--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 20260801 (experimental) (GCC)
$
$ gcc-trunk -O0 small.c
$ gcc-trunk -O3 small.c
during GIMPLE pass: vrp
small.c: In function ‘k’:
small.c:22:6: internal compiler error: in upper_bound, at value-range.h:1281
   22 | char k() {
      |      ^
0x258ec0f internal_error(char const*, ...)
       
/data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostic-global-context.cc:787
0x2597a4f fancy_abort(char const*, int, char const*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/diagnostics/context.cc:1813
0xf50bf0 irange::upper_bound() const
        /data/x27zhou/compiler-nightly/src/gcc/gcc/value-range.h:1281
0xf50bf0 operator_lshift::op1_range(irange&, tree_node*, irange const&, irange
const&, relation_trio) const
        /data/x27zhou/compiler-nightly/src/gcc/gcc/range-op.cc:2913
0xc2b273 gori_compute::compute_operand1_range(vrange&,
gimple_range_op_handler&, vrange const&, fur_source&, value_relation*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:0
0xc2a98e gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:677
0xc2af53 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:791
0xc2c6c3 gori_compute::compute_operand1_and_operand2_range(vrange&,
gimple_range_op_handler&, vrange const&, tree_node*, fur_source&,
value_relation*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:1317
0xc2ad8e gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:769
0xc2af53 gori_compute::compute_operand_range(vrange&, gimple*, vrange const&,
tree_node*, fur_source&, value_relation*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:791
0xc2d1ae gori_compute::edge_range_p(vrange&, edge_def*, tree_node*,
range_query&)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-gori.cc:1443
0xc1bb03 ranger_cache::edge_range(vrange&, edge_def*, tree_node*,
ranger_cache::rfd_mode)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-cache.cc:1317
0xc1d222 ranger_cache::resolve_dom(vrange&, tree_node*, basic_block_def*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-cache.cc:1773
0xc1b835 ranger_cache::range_from_dom(vrange&, tree_node*, basic_block_def*,
ranger_cache::rfd_mode)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-cache.cc:1884
0xc1c057 ranger_cache::fill_block_cache(tree_node*, basic_block_def*,
basic_block_def*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-cache.cc:1570
0xc1bde3 ranger_cache::block_range(vrange&, basic_block_def*, tree_node*, bool)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-cache.cc:1397
0xc13683 gimple_ranger::range_on_entry(vrange&, basic_block_def*, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:189
0xc13324 gimple_ranger::range_of_expr(vrange&, tree_node*, gimple*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range.cc:158
0xc20f70 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:806
0xc1ecae fold_using_range::fold_stmt(vrange&, gimple*, fur_source&, tree_node*)
        /data/x27zhou/compiler-nightly/src/gcc/gcc/gimple-range-fold.cc:698
/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/ccrDpccd.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
long a;
char b;
short c;
int f(int g) {
  {
    unsigned h = g;
    {
      long d = h;
      int e = 0;
      do {
        if ((h & 15) == 4)
          d = d + (h << 5);
        if (d == 5)
          break;
        e = e + 1;
      } while (e < 3);
      c = d;
    }
  }
  return c;
}
char k() {
  long i;
  unsigned j = b % 6u + 4;
  while (a)
    i = f(j + 826);
  return i;
}
int main() {}

Reply via email to