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

            Bug ID: 61965
           Summary: [gcc-4.8.2] ICE:in compute_affine_dependence (at
                    tree-data-ref.c:4170)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sabrinadfs at gmail dot com

Created attachment 33214
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33214&action=edit
test log

x86_64-unknown-linux-gnu
GCC version: 4.8.2

Running the test 20090922-1.c from gcc.dg package GCC throw an ICE with these
options:
-Wno-format/-fno-sanitize=address/-fno-align-functions/-fno-align-jumps/-fno-align-loops/-fno-align-labels/-fno-ipa-cp/-fno-ipa-pure-const/-fno-ipa-reference/-fno-tree-pta//-fno-selective-scheduling/-fno-selective-scheduling2/-fno-reorder-blocks-and-partition/-fcheck-data-deps/-fno-unswitch-loops/-fno-predictive-commoning/-fno-tree-vectorize/-fno-tree-partial-pre/-fno-strict-aliasing/-fno-syntax-only

I also managed to reproduce the ICE out of DejaGnu just by running this line:

/home/sabrina/gcc/objdir/gcc/xgcc -B/home/sabrina/gcc/objdir/gcc/
/home/sabrina/gcc/gcc-4.8.2/gcc/testsuite/gcc.dg/20090922-1.c
-fno-diagnostics-show-caret -O2 -g -funroll-loops -std=gnu99 -S -Wno-format
-fno-sanitize=address -fno-align-functions -fno-align-jumps -fno-align-loops
-fno-align-labels -fno-ipa-cp -fno-ipa-pure-const -fno-ipa-reference
-fno-tree-pta -fno-selective-scheduling -fno-selective-scheduling2
-fno-reorder-blocks-and-partition -fcheck-data-deps -fno-unswitch-loops
-fno-predictive-commoning -fno-tree-vectorize -fno-tree-partial-pre
-fno-strict-aliasing -fno-syntax-only -o 20090922-1.c


Here is the testcode (../gcc/testsuite/gcc.dg/20090922-1.c): 
----------------------------------------------------------------------------
/* { dg-do compile } */
/* { dg-options "-O2 -g -funroll-loops -std=gnu99" } */

struct S
{
  unsigned long s1;
  int **s2;
};
struct T
{
  unsigned long t1, t2;
};
struct U
{
  int u1, u2;
  unsigned long u3;
};
struct V
{
  int v1, v3;
  struct T *v2;
  struct U *v4;
};
struct W
{
  int w1;
  struct V **w2;
};
struct S *foo1 (void);
int *foo2 (void);

void
test (struct W *w)
{
  for (int i = 0; i < w->w1; i++)
    {
      struct V *v = w->w2[i];
      struct S *t = foo1 ();
      if (!t)
    for (int j; j < v->v1;)
      {
        struct T *q = &v->v2[j];
        t += (q->t2 - q->t1) * 45000L;
      }
      for (; v->v3;)
    {
      struct U *v4 = (struct U *) &v->v4;
      if (v4->u1 && v4->u2 >= 0 && v4->u2)
        {
          int *s = foo2 ();
          if (!s)
        for (int k = 0; k <= v4->u2; k++)
          {
            struct T *q = &v->v2[k];
            if (k == v4->u2)
              v4->u3 += (q->t1) * 1000000;
          }
          t->s2[t->s1] = s;
        }
    }
      int *s = foo2 ();
      if (!t)
    t->s2[t->s1] = s;
    }
}
----------------------------------------------------------------------------


Here is the output:
----------------------------------------------------------------------------
(Number of distance vectors differ: Banerjee has 2, Omega has 1.
Banerjee dist vectors:
  0 
  1 
Omega dist vectors:
  0 
data dependence relation:
(Data Dep: 
#(Data Ref: 
#  bb: 17 
#  stmt: _47 = MEM[(struct U *)v_19 + 16B].u3;
#  ref: MEM[(struct U *)v_19 + 16B].u3;
#  base_object: MEM[(struct U *)v_19 + 16B];
#  Access function 0: 64
#)
#(Data Ref: 
#  bb: 17 
#  stmt: MEM[(struct U *)v_19 + 16B].u3 = _50;
#  ref: MEM[(struct U *)v_19 + 16B].u3;
#  base_object: MEM[(struct U *)v_19 + 16B];
#  Access function 0: 64
#)
  access_fn_A: 64
  access_fn_B: 64

 (subscript 
  iterations_that_access_an_element_twice_in_A: [0]
  last_conflict: scev_not_known
  iterations_that_access_an_element_twice_in_B: [0]
  last_conflict: scev_not_known
  (Subscript distance: 0 ))
  inner loop index: 0
  loop nest: (4 )
  distance_vector:   0 
  direction_vector:     =
)
)
/home/sabrina/gcc/gcc-4.8.2/gcc/testsuite/gcc.dg/20090922-1.c: In function
‘test’:
/home/sabrina/gcc/gcc-4.8.2/gcc/testsuite/gcc.dg/20090922-1.c:33:1: internal
compiler error: in compute_affine_dependence, at tree-data-ref.c:4170
0xbcc0d2 compute_affine_dependence(data_dependence_relation*, loop*)
    .././../gcc-4.8.2/gcc/tree-data-ref.c:4169
0xbce98d 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-4.8.2/gcc/tree-data-ref.c:4241
0xbcef83 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-4.8.2/gcc/tree-data-ref.c:4531
0xbcf18f analyze_all_data_dependences
    .././../gcc-4.8.2/gcc/tree-data-ref.c:4639
0xbcf18f tree_check_data_deps()
    .././../gcc-4.8.2/gcc/tree-data-ref.c:4687
0x8b62a7 check_data_deps
    .././../gcc-4.8.2/gcc/tree-ssa-loop.c:330
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <http://gcc.gnu.org/bugs.html> for instructions.
----------------------------------------------------------------------------


I would like to know if it is really a bug and what can I do to fix it?

Thanks,
Sabrina de F. Souto.

Reply via email to