view gcc/testsuite/gcc.dg/graphite/isl-ast-gen-if-1.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
line wrap: on
line source

int st = 1;
static void __attribute__((noinline))
foo (int a[], int n)
{
  int i;
  for (i = 0; i < n; i++)
    {
      if (i < 25)
        a[i] = i;
      a[n - i] = 1;
    }
}

static int __attribute__((noinline))
array_sum (int a[])
{
  int i, res = 0;
  for(i = 0; i < 50; i += st)
    res += a[i];
  return res;
}

extern void abort ();

int
main (void)
{
  int a[51]; /* NB This size allows foo's first iteration to write to a[50].  */
  foo (a, 50);
  int res = array_sum (a);
  if (res != 49)
    abort ();
  return 0;
}