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

            Bug ID: 120922
           Summary: [16 Regression] RISC-V: ICE during GIMPLE pass: vect
                    in verify_range with -mrvv-max-lmul=m8
           Product: gcc
           Version: 16.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ewlu at rivosinc dot com
  Target Milestone: ---

Created attachment 61777
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=61777&action=edit
freport-bug output

Testcase:
char g;
unsigned char h;
int i[9][6];
int main() {
  int k[5];
  if (g)
    goto l;
  for (; h <= 5; h++)
    i[0][h] = *k;
l:
  return 0;
}

Command/backtrace:
$
/scratch/ewlu/daily-upstream-build/build-gcv/bin/riscv64-unknown-linux-gnu-gcc
-I/scratch/ewlu/ci/compiler-fuzz-ci/csmith-build/include -fsigned-char
-fno-strict-aliasing -fwrapv -march=rv64gcv_zvl1024b -mrvv-vector-bits=zvl
-mrvv-max-lmul=m8 -O3 red.c -o rv64gcv.out -w -freport-bug
during GIMPLE pass: vect
red.c: In function 'main':
red.c:4:5: internal compiler error: in verify_range, at value-range.cc:1554
    4 | int main() {
      |     ^~~~
0x2e5faa6 internal_error(char const*, ...)
        ../../../gcc/gcc/diagnostic-global-context.cc:517
0xd2076b fancy_abort(char const*, int, char const*)
        ../../../gcc/gcc/diagnostic.cc:1810
0xc37f9b irange::verify_range() const
        ../../../gcc/gcc/value-range.cc:1554
0x1884439 irange::set(tree_node*, generic_wide_int<wide_int_storage> const&,
generic_wide_int<wide_int_storage> const&, value_range_kind)
        ../../../gcc/gcc/value-range.cc:1497
0x17f708c int_range<1u, false>::int_range(tree_node*,
generic_wide_int<wide_int_storage> const&, generic_wide_int<wide_int_storage>
const&, value_range_kind)
        ../../../gcc/gcc/value-range.h:1114
0x17f708c vect_gen_vector_loop_niters(_loop_vec_info*, tree_node*, tree_node**,
tree_node**, bool)
        ../../../gcc/gcc/tree-vect-loop-manip.cc:2870
0x17ec977 vect_transform_loop(_loop_vec_info*, gimple*)
        ../../../gcc/gcc/tree-vect-loop.cc:11886
0x1838648 vect_transform_loops
        ../../../gcc/gcc/tree-vectorizer.cc:1044
0x1838cf4 try_vectorize_loop_1
        ../../../gcc/gcc/tree-vectorizer.cc:1193
0x1838cf4 try_vectorize_loop
        ../../../gcc/gcc/tree-vectorizer.cc:1223
0x18390ac execute
        ../../../gcc/gcc/tree-vectorizer.cc:1339
Please submit a full bug report, with preprocessed source.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Preprocessed source stored into /tmp/cc9vBhjt.out file, please attach this to
your bugreport.

Error does not appear with lmul < m8 but can be reproduced with
-mrvv-max-lmul=dynamic which makes sense.

Godbolt: https://godbolt.org/z/99sn9cajG

Found via fuzzer

Reply via email to