blob: a0eb24216db7e8ec75582a38b87436d9ad25d122 (
plain)
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
|
int st = 1;
static void __attribute__((noinline))
foo (int a[], int n)
{
int i;
for (i = 0; i < n; i++)
{
if (i < 25)
a[i] = i;
a[n - i] = 1;
}
}
static int __attribute__((noinline))
array_sum (int a[])
{
int i, res = 0;
for(i = 0; i < 50; i += st)
res += a[i];
return res;
}
extern void abort ();
int
main (void)
{
int a[51]; /* NB This size allows foo's first iteration to write to a[50]. */
foo (a, 50);
int res = array_sum (a);
if (res != 49)
abort ();
return 0;
}
|