view gcc/testsuite/gcc.dg/graphite/pr46185.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
line wrap: on
line source

/* { dg-do run } */
/* { dg-require-effective-target size32plus } */
/* { dg-require-effective-target int32plus } */
/* { dg-options "-O2 -floop-nest-optimize -ffast-math -fno-ipa-cp" } */

#define DEBUG 0
#if DEBUG
#include <stdio.h>
#endif

double u[1782225];

static int __attribute__((noinline))
foo (int N, int *res)
{
  int i, j;
  double sum = 0;
  for (i = 0; i < N; i++)
    for (j = 0; j < N; j++)
      sum = sum + u[i + 1335 * j];

  for (i = 0; i < N; i++)
    u[1336 * i] *= 2;

  *res = sum + N + u[1336 * 2] + u[1336];
}

extern void abort ();

int
main (void)
{
  int i, j, res;

  for (i = 0; i < 1782225; i++)
    u[i] = 2;

  foo (1335, &res);

#if DEBUG
  fprintf (stderr, "res = %d \n", res);
#endif

  if (res != 3565793)
    abort ();

  return 0;
}