Merge with gcc-4_3-branch up to revision 175516.
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20100430-1.c
blobd29c6fa1a37c53cd1a721f8a752e2e64dd9eb69a
1 /* This used to generate unaligned accesses at -O2 because of IVOPTS. */
3 struct packed_struct
5 struct packed_struct1
7 unsigned char cc11;
8 unsigned char cc12;
9 } __attribute__ ((packed)) pst1;
10 struct packed_struct2
12 unsigned char cc21;
13 unsigned char cc22;
14 unsigned short ss[104];
15 unsigned char cc23[13];
16 } __attribute__ ((packed)) pst2[4];
17 } __attribute__ ((packed));
19 typedef struct
21 int ii;
22 struct packed_struct buf;
23 } info_t;
25 static unsigned short g;
27 static void __attribute__((noinline))
28 dummy (unsigned short s)
30 g = s;
33 static int
34 foo (info_t *info)
36 int i, j;
38 for (i = 0; i < info->buf.pst1.cc11; i++)
39 for (j = 0; j < info->buf.pst2[i].cc22; j++)
40 dummy (info->buf.pst2[i].ss[j]);
42 return 0;
45 int main(void)
47 info_t info;
48 info.buf.pst1.cc11 = 2;
49 info.buf.pst2[0].cc22 = info.buf.pst2[1].cc22 = 8;
50 return foo (&info);