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

            Bug ID: 113210
           Summary: [14] RISC-V vector ICE: tree check: expected
                    integer_cst, have cond_expr in get_len, at tree.h:6481
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: patrick at rivosinc dot com
  Target Milestone: ---

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

Testcase:
char a, c;
short b;
void d() {
  c = a - 1;
  b = c;
  unsigned short *e = &b;
  while (++*e > 256)
    ;
}

Command:
> /scratch/tc-testing/tc-jan-1-trunk/build-rv64gcv/bin/riscv64-unknown-linux-gnu-gcc
>  -march=rv64gcv -O2 red.c -freport-bug

during GIMPLE pass: vect
red.c: In function 'd':
red.c:3:6: internal compiler error: tree check: expected integer_cst, have
cond_expr in get_len, at tree.h:6481
    3 | void d() {
      |      ^
0xab8132 tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../../gcc/gcc/tree.cc:8952
0xc97cb2 tree_check(tree_node const*, char const*, int, char const*, tree_code)
        ../../../gcc/gcc/tree.h:3900
0xc97cb2 wi::extended_tree<131072>::get_len() const
        ../../../gcc/gcc/tree.h:6481
0xc97cb2 wi::int_traits<generic_wide_int<wi::extended_tree<131072> >
>::decompose(long*, unsigned int, generic_wide_int<wi::extended_tree<131072> >
const&)
        ../../../gcc/gcc/wide-int.h:1050
0xc97cb2 wide_int_ref_storage<true,
false>::wide_int_ref_storage<generic_wide_int<wi::extended_tree<131072> >
>(generic_wide_int<wi::extended_tree<131072> > const&, unsigned int)
        ../../../gcc/gcc/wide-int.h:1099
0xc97cb2 generic_wide_int<wide_int_ref_storage<true, false>
>::generic_wide_int<generic_wide_int<wi::extended_tree<131072> >
>(generic_wide_int<wi::extended_tree<131072> > const&, unsigned int)
        ../../../gcc/gcc/wide-int.h:855
0xc97cb2 wi::binary_traits<generic_wide_int<wi::extended_tree<131072> >, int,
wi::int_traits<generic_wide_int<wi::extended_tree<131072> > >::precision_type,
wi::int_traits<int>::precision_type>::result_type
wi::add<generic_wide_int<wi::extended_tree<131072> >,
int>(generic_wide_int<wi::extended_tree<131072> > const&, int const&)
        ../../../gcc/gcc/wide-int.h:2871
0x156f0e7 wi::binary_traits<generic_wide_int<wi::extended_tree<131072> >, int,
wi::int_traits<generic_wide_int<wi::extended_tree<131072> > >::precision_type,
wi::int_traits<int>::precision_type>::operator_result
operator+<generic_wide_int<wi::extended_tree<131072> >,
int>(generic_wide_int<wi::extended_tree<131072> > const&, int const&)
        ../../../gcc/gcc/wide-int.h:3857
0x156f0e7 vect_analyze_loop_costing
        ../../../gcc/gcc/tree-vect-loop.cc:2270
0x157ff01 vect_analyze_loop_2
        ../../../gcc/gcc/tree-vect-loop.cc:3166
0x1581a20 vect_analyze_loop_1
        ../../../gcc/gcc/tree-vect-loop.cc:3461
0x15821b9 vect_analyze_loop(loop*, vec_info_shared*)
        ../../../gcc/gcc/tree-vect-loop.cc:3619
0x15c84d4 try_vectorize_loop_1
        ../../../gcc/gcc/tree-vectorizer.cc:1066
0x15c84d4 try_vectorize_loop
        ../../../gcc/gcc/tree-vectorizer.cc:1182
0x15c8dfc execute
        ../../../gcc/gcc/tree-vectorizer.cc:1298
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 /scratch/tmp/ccdgSv2l.out file, please attach
this to your bugreport.

Godbolt: https://godbolt.org/z/x851M9q7n

The ICE goes away if you change the 256 -> 255

-freport-bug output attached.

Reply via email to