1 /* { dg-do run } */ 2 /* { dg-require-effective-target size32plus } */ 3 /* { dg-require-effective-target int32plus } */ 4 /* { dg-options "-O2 -floop-nest-optimize -ffast-math -fno-ipa-cp" } */ 5 6 #define DEBUG 0 7 #if DEBUG 8 #include <stdio.h> 9 #endif 10 11 double u[1782225]; 12 13 static int __attribute__((noinline)) foo(int N,int * res)14foo (int N, int *res) 15 { 16 int i, j; 17 double sum = 0; 18 for (i = 0; i < N; i++) 19 for (j = 0; j < N; j++) 20 sum = sum + u[i + 1335 * j]; 21 22 for (i = 0; i < N; i++) 23 u[1336 * i] *= 2; 24 25 *res = sum + N + u[1336 * 2] + u[1336]; 26 } 27 28 extern void abort (); 29 30 int main(void)31main (void) 32 { 33 int i, j, res; 34 35 for (i = 0; i < 1782225; i++) 36 u[i] = 2; 37 38 foo (1335, &res); 39 40 #if DEBUG 41 fprintf (stderr, "res = %d \n", res); 42 #endif 43 44 if (res != 3565793) 45 abort (); 46 47 return 0; 48 } 49