OSDN Git Service

2009-01-10 Sebastian Pop <sebastian.pop@amd.com>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / 20030309-1.c
1 /* { dg-do link } */
2 /* { dg-options "-O2" } */
3
4 struct A0 { int x; };
5 struct A1 { int x; int y[1]; };
6 struct A2 { int x; int y[2]; };
7 struct A3 { int x; int y[3]; };
8 struct A4 { int x; int y[4]; };
9
10 void *s;
11 int u;
12
13 int
14 main (void)
15 {
16   int x;
17   void *t = s;
18
19   switch (u)
20     {
21     case 0:
22       x = ((struct A0 *) t)->x;
23       break;
24     case 1:
25       x = ((struct A1 *) t)->x;
26       break;
27     case 2:
28       x = ((struct A2 *) t)->x;
29       break;
30     case 3:
31       x = ((struct A3 *) t)->x;
32       break;
33     case 4:
34       x = ((struct A4 *) t)->x;
35       break;
36     default:
37       x = 0;
38       break;
39     }
40
41   return x;
42 }