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

            Bug ID: 84416
           Summary: internal compiler error: in int_cst_value, at
                    tree.c:11089
           Product: gcc
           Version: 8.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: shlei930 at gmail dot com
  Target Milestone: ---

It seems gcc version 5.4.1, version 6.3.0, version 7.2.0 also have similar
problems when complied with -O3. gcc version 4.8.5 is able to compile.

$gcc-trunk -v
gcc version 8.0.1 20180208 (experimental) [trunk revision 257504] (GCC)
Target: x86_64-pc-linux-gnu
Thread model: posix

$gcc-trunk -O3 -c abc.c
abc.c:1:8: warning: type defaults to ‘int’ in declaration of ‘a’
[-Wimplicit-int]
 static a[];
        ^
abc.c:2:1: warning: data definition has no type or storage class
 b;
 ^
abc.c:2:1: warning: type defaults to ‘int’ in declaration of ‘b’
[-Wimplicit-int]
abc.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 fn1() {
 ^~~
abc.c: In function ‘fn1’:
abc.c:5:18: warning: integer constant is so large that it is unsigned
     a[b] = a[b - 18446744073709551607];
                  ^~~~~~~~~~~~~~~~~~~~
during GIMPLE pass: pcom
abc.c:3:1: internal compiler error: in int_cst_value, at tree.c:11089
 fn1() {
 ^~~
0x6f687c int_cst_value(tree_node const*)
        ../../gcc/gcc/tree.c:11089
0x14fddab analyze_subscript_affine_affine
        ../../gcc/gcc/tree-data-ref.c:3609
0x1502ed4 analyze_siv_subscript
        ../../gcc/gcc/tree-data-ref.c:3926
0x1502ed4 analyze_overlapping_iterations
        ../../gcc/gcc/tree-data-ref.c:4156
0x1502ed4 subscript_dependence_tester_1
        ../../gcc/gcc/tree-data-ref.c:4697
0x1503427 subscript_dependence_tester_1
        ../../gcc/gcc/tree-data-ref.c:4693
0x1503427 subscript_dependence_tester
        ../../gcc/gcc/tree-data-ref.c:4747
0x1503427 compute_affine_dependence(data_dependence_relation*, loop*)
        ../../gcc/gcc/tree-data-ref.c:4806
0x1504fec 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:4873
0x15057da 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:5272
0xd76d09 tree_predictive_commoning_loop
        ../../gcc/gcc/tree-predcom.c:3190
0xd79d5d 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.

$cat abc.c
static a[];
b;
fn1() {
  for (;; b++)
    a[b] = a[b - 18446744073709551607];
}

Reply via email to