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