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