| 1 |
/* { dg-do run } */ |
| 2 |
|
| 3 |
extern void abort(void); |
| 4 |
extern int rand(void); |
| 5 |
|
| 6 |
static void copy(int *r,int *a,int na) |
| 7 |
{ |
| 8 |
int i; |
| 9 |
for( i = 0 ; i < na ; i++ ) |
| 10 |
r[i] = a[i]; |
| 11 |
} |
| 12 |
|
| 13 |
static void foo(int *a,int na) |
| 14 |
{ |
| 15 |
int i; |
| 16 |
for( i = 0 ; i < na ; i++ ) |
| 17 |
a[i] = rand(); |
| 18 |
} |
| 19 |
|
| 20 |
static int cmp(int *a,int *b,int n) |
| 21 |
{ |
| 22 |
int i; |
| 23 |
for( i = 0 ; i < n ; i++ ) |
| 24 |
if ( a[i] != b[i] ) |
| 25 |
return -1; |
| 26 |
return 0; |
| 27 |
} |
| 28 |
|
| 29 |
void __attribute__((noinline,noclone)) |
| 30 |
test(int sz,int comm) |
| 31 |
{ |
| 32 |
int j,n; |
| 33 |
int v[64],w[64]; |
| 34 |
for( j = 1 ; j <= sz ; j++ ) |
| 35 |
{ |
| 36 |
n = (2 * j - 1) * (2 * j - 1); |
| 37 |
foo(w,n); |
| 38 |
copy(v,w,n); |
| 39 |
if ( comm ) |
| 40 |
if ( cmp(v,w,n) ) abort (); |
| 41 |
} |
| 42 |
} |
| 43 |
|
| 44 |
int main() |
| 45 |
{ |
| 46 |
test(2,1); |
| 47 |
return 0; |
| 48 |
} |