[Bug tree-optimization/58453] [4.9 Regression] Revision 202431 results in miscompare for CPU2006 434.zeusmp

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Sep 18 12:57:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58453

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Ah, so we have

  _103 = fieldr.e[_51];
  _104 = _102 * _103;
  fieldr.e[_51] = _104;
  _106 = fieldr.d[_51];
  *dlo_107(D)[_51] = _106;
  _109 = _104 / _106;
  *eod_110(D)[_51] = _109;

and distribute it as

  _103 = fieldr.e[_51];
  _104 = _102 * _103;
  fieldr.e[_51] = _104;

  memcpy (dlo, &fieldr.d, ...)

  _103 = fieldr.e[_51];
  _104 = _102 * _103;
  _106 = fieldr.d[_51];
  _109 = _104 / _106;
  *eod_110(D)[_51] = _109;

but that's obviously wrong as we are re-loading a different fieldr.e.

Testcase:

extern void abort (void);

int a[128], b[128], c[128], d[128];

void __attribute__((noinline,noclone))
foo (void)
{
  int i;
  for (i = 0; i < 128; ++i)
    {
      a[i] = a[i] + 1;
      b[i] = d[i];
      c[i] = a[i] / d[i];
    }
}
int main()
{
  int i;
  for (i = 0; i < 128; ++i)
    a[i] = i;
  for (i = 0; i < 128; ++i)
    d[i] = 1;
  foo ();
  if (c[0] != 1)
    abort ();
  return 0;
}



More information about the Gcc-bugs mailing list