blob: 49245a0b39f151bfe6084ed0c7067c908e1c2622 (
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
struct A
{
unsigned long p, q, r, s;
} x = { 13, 14, 15, 16 };
extern void abort (void);
extern void exit (int);
static inline struct A *
bar (void)
{
struct A *r;
switch (8)
{
case 2:
abort ();
break;
case 8:
r = &x;
break;
default:
abort ();
break;
}
return r;
}
void
foo (unsigned long *x, int y)
{
if (y != 12)
abort ();
if (x[0] != 1 || x[1] != 11)
abort ();
if (x[2] != 2 || x[3] != 12)
abort ();
if (x[4] != 3 || x[5] != 13)
abort ();
if (x[6] != 4 || x[7] != 14)
abort ();
if (x[8] != 5 || x[9] != 15)
abort ();
if (x[10] != 6 || x[11] != 16)
abort ();
}
int
main (void)
{
unsigned long a[40];
int b = 0;
a[b++] = 1;
a[b++] = 11;
a[b++] = 2;
a[b++] = 12;
a[b++] = 3;
a[b++] = bar()->p;
a[b++] = 4;
a[b++] = bar()->q;
a[b++] = 5;
a[b++] = bar()->r;
a[b++] = 6;
a[b++] = bar()->s;
foo (a, b);
exit (0);
}
|