Comment 8 for bug 972648

Revision history for this message
Ulrich Weigand (uweigand) wrote :

A minimal (C) test case (with "-O -ftree-vectorize") for me is:

struct test
{
  unsigned long exp[0];
};

void test (struct test *a, long b, unsigned long bitmask)
{
  if (b > 0)
    {
      a->exp[0] &= ~bitmask;
      a->exp[0] |= b;
    }
  else
    {
      a->exp[0] &= ~bitmask;
    }
}

The problem here is a bug in the data dependency detection when zero-sized arrays are involved in an access.

This bug was latent, and got exposed by Ira's patch to improve conditional store sinking:
http://gcc.gnu.org/ml/gcc-patches/2011-03/msg01393.html

The bug was later fixed (inadvertently) by Richard Guenther's data-dependency fix series, in particular this patch:
http://gcc.gnu.org/ml/gcc-patches/2011-08/msg01878.html

Since both of these patches are in mainline (and FSF 4.7, and Linaro 4.7), the bug is not appear there.
Since FSF 4.6 contains neither of those, the bug is latent (without visible effect) there.

The bug does appear in Linaro 4.6, since we backported Ira's patch but not Richard's data-dependency fix.

I'll try testing a backport of that fix.