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

            Bug ID: 84929
           Summary: ICE at -O3 on valid code on x86_64-linux-gnu: tree
                    check: expected polynomial_chrec, have nop_expr in
                    analyze_siv_subscript_cst_affine, at
                    tree-data-ref.c:3018
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: helloqirun at gmail dot com
  Target Milestone: ---

It happens at -O3. "-O2" works fine.


$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/home/absozero/trunk/root-gcc/libexec/gcc/x86_64-pc-linux-gnu/8.0.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc/configure --prefix=/home/absozero/trunk/root-gcc
--enable-languages=c,c++ --disable-werror --enable-multilib
Thread model: posix
gcc version 8.0.1 20180317 (experimental) [trunk revision 258620] (GCC)


$ gcc-trunk -O3 abc.c
during GIMPLE pass: pcom
abc.c: In function ‘fn1’:
abc.c:2:6: internal compiler error: tree check: expected polynomial_chrec, have
nop_expr in analyze_siv_subscript_cst_affine, at tree-data-ref.c:3018
 void fn1() {
      ^~~
0x6f05ca tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        ../../gcc/gcc/tree.c:9322
0x76fe1b analyze_siv_subscript_cst_affine
        ../../gcc/gcc/tree.h:3135
0x1514588 analyze_siv_subscript
        ../../gcc/gcc/tree-data-ref.c:3898
0x1514588 analyze_overlapping_iterations
        ../../gcc/gcc/tree-data-ref.c:4153
0x1514588 subscript_dependence_tester_1
        ../../gcc/gcc/tree-data-ref.c:4694
0x1514a37 subscript_dependence_tester_1
        ../../gcc/gcc/tree-data-ref.c:4690
0x1514a37 subscript_dependence_tester
        ../../gcc/gcc/tree-data-ref.c:4744
0x1514a37 compute_affine_dependence(data_dependence_relation*, loop*)
        ../../gcc/gcc/tree-data-ref.c:4803
0x151661c compute_all_dependences(vec<data_reference*, va_heap, vl_ptr>,
vec<data_dependence_relation*, va_heap, vl_ptr>*, vec<loop*, va_heap, vl_ptr>,
bool)
        ../../gcc/gcc/tree-data-ref.c:4870
0x1516e0a compute_data_dependences_for_loop(loop*, bool, vec<loop*, va_heap,
vl_ptr>*, vec<data_reference*, va_heap, vl_ptr>*,
vec<data_dependence_relation*, va_heap, vl_ptr>*)
        ../../gcc/gcc/tree-data-ref.c:5269
0xd7d589 tree_predictive_commoning_loop
        ../../gcc/gcc/tree-predcom.c:3190
0xd805dd tree_predictive_commoning()
        ../../gcc/gcc/tree-predcom.c:3312
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

$ cat abc.c
int a[4];
void fn1() {
  unsigned long b = 7818038963515661296;
  for (;; b++)
    a[0xA699ECD2C348A3A0] = a[b];
}

Reply via email to