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

--- Comment #3 from vries at gcc dot gnu.org ---
A way to look at the problem is to compare against the dump info for the
variant without the extra (redundant) dimension.

So, compare dump-info for -DEXTRADIM={0,1} for this source:
...
#if EXTRADIM
int yu[4][1] = { { 1 }, { 2 }, { 3 }, { 4 } };

int
main (void)
{
  int zh, ro;

  for (zh = 0; zh < 2; ++zh)
    for (ro = 0; ro < 3; ++ro)
      yu[ro][0] = yu[zh + 1][0];

  return yu[0][0]; /* Should be 2, but returns 3.  */
}

#else

int yu[4] = { 1, 2, 3, 4 };

int
main (void)
{
  int zh, ro;

  for (zh = 0; zh < 2; ++zh)
    for (ro = 0; ro < 3; ++ro)
      yu[ro] = yu[zh + 1];

  return yu[0]; /* Returns 3.  */
}

#endif
...

This shows a bit of the unified diff of the dump info. The fact that the data
references show no reads, is probably already indicative of a problem:
...
 data references (
-  reads: { S_4[i1, i2] -> [1, 1 + i1] : i1 >= 0 and i1 <= 1 and i2 <= 2 and i2
>= 0 }
-  must_writes: { S_4[i1, i2] -> [1, i2] : i2 >= 0 and i2 <= 2 and i1 >= 0 and
i1 <= 1 }
+  reads: {  }
+  must_writes: { S_4[i1, 0] -> [1, 0, 0] : i1 >= 0 and i1 <= 1 }
   may_writes: {  }
 )
 data dependences (
-{ S_4[i1, i2] -> S_4[i1, i2'] : i2' >= 1 + i1 and i2' <= 1 + i1 + i2 and i2'
>= 1 + i2 and i2' <= 2; S_4[0, i2] -> S_4[1, i2'] : i2' >= 2 - i2 and \
i2' <= i2 and i2 <= 2; S_4[0, 0] -> S_4[1, 0] }
+{ S_4[0, 0] -> S_4[1, 0] }
 )
...

Reply via email to