[Bug tree-optimization/87917] ICE in initialize_matrix_A at gcc/tree-data-ref.c:3150

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 8 09:57:00 GMT 2018


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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sebpop at gmail dot com

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I get:

during GIMPLE pass: ldist
pr34635.c: In function ‘foo’:
pr34635.c:4:6: internal compiler error: tree check: expected integer_cst, have
polynomial_chrec in int_cst_value, at tree.c:11188
4 | void foo(int x[])
  |      ^~~
0x1397ffc tree_check_failed(tree_node const*, char const*, int, char const*,
...)
        /tmp/trunk/gcc/tree.c:9371
0x83e3a7 tree_int_cst_elt_check(tree_node const*, int, char const*, int, char
const*)
        /tmp/trunk/gcc/tree.h:3307
0x13a0e5b int_cst_value(tree_node const*)
        /tmp/trunk/gcc/tree.c:11188

#11 0x00000000010cf399 in get_data_dependence (rdg=0x2816ba0, a=0x2817830, 
    b=0x28170c0) at /tmp/trunk/gcc/tree-loop-distribution.c:1188
1188          compute_affine_dependence (ddr, loop_nest[0]);
(gdb) l
1183      ent.b = b;
1184      slot = ddrs_table->find_slot (&ent, INSERT);
1185      if (*slot == NULL)
1186        {
1187          ddr = initialize_data_dependence_relation (a, b, loop_nest);
1188          compute_affine_dependence (ddr, loop_nest[0]);
1189          *slot = ddr;
1190        }
(gdb) p debug_data_reference (a)
#(Data Ref: 
#  bb: 3 
#  stmt: _8 = *_4;
#  ref: *_4;
#  base_object: *x_22(D);
#  Access function 0: {0B, +, {0, +, 4}_1}_2
#)
$6 = void
(gdb) p debug_data_reference (b)
#(Data Ref: 
#  bb: 3 
#  stmt: *_7 = _8;
#  ref: *_7;
#  base_object: *x_22(D);
#  Access function 0: {0B, +, 4}_1
#)

so we have an "invariant" access and a variant one.

I think

  else if (evolution_function_is_affine_multivariate_p (chrec_a,
loop_nest->num)
           && !chrec_contains_symbols (chrec_a)
           && evolution_function_is_affine_multivariate_p (chrec_b,
loop_nest->num)
           && !chrec_contains_symbols (chrec_b))
    {
      /* testsuite/.../ssa-chrec-35.c
         {0, +, 1}_2  vs.  {0, +, 1}_3
         the overlapping elements are respectively located at iterations:
         {0, +, 1}_x and {0, +, 1}_x,
         in other words, we have the equality:
         {0, +, 1}_2 ({0, +, 1}_x) = {0, +, 1}_3 ({0, +, 1}_x)

         Other examples:
         {{0, +, 1}_1, +, 2}_2 ({0, +, 1}_x, {0, +, 1}_y) =
         {0, +, 1}_1 ({{0, +, 1}_x, +, 2}_y)

         {{0, +, 2}_1, +, 3}_2 ({0, +, 1}_y, {0, +, 1}_x) =
         {{0, +, 3}_1, +, 2}_2 ({0, +, 1}_x, {0, +, 1}_y)
      */
      analyze_subscript_affine_affine (chrec_a, chrec_b,
                                       overlaps_a, overlaps_b, last_conflicts);


is not properly guarded.  evolution_function_is_affine_multivariate_p
lets this through via

bool
evolution_function_is_affine_multivariate_p (const_tree chrec, int loopnum)
{
  if (chrec == NULL_TREE)
    return false;

  switch (TREE_CODE (chrec))
    {
    case POLYNOMIAL_CHREC:
      if (evolution_function_is_invariant_rec_p (CHREC_LEFT (chrec), loopnum))
        {
          if (evolution_function_is_invariant_rec_p (CHREC_RIGHT (chrec),
loopnum))
            return true;
          else
            {
              if (TREE_CODE (CHREC_RIGHT (chrec)) == POLYNOMIAL_CHREC
                  && CHREC_VARIABLE (CHREC_RIGHT (chrec))
                     != CHREC_VARIABLE (chrec)
                  && evolution_function_is_affine_multivariate_p
                  (CHREC_RIGHT (chrec), loopnum))

but as we are interested in loopnum == 1 for {0, +, {0, +, 4}_1}_2
we have to exclude the case where CHREC_RIGHT variates in it.

Whatever exactly a affine multivariate is...

Sebastian - can you say if

 evolution_function_is_affine_multivariate_p ({0, +, {0, +, 4}_1}_2, 1)

should really return true?


More information about the Gcc-bugs mailing list