OSDN Git Service

Merge lto branch into trunk.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 20081218-1.c
1 struct A { int i, j; char pad[512]; } a;
2
3 int __attribute__((noinline))
4 foo (void)
5 {
6   __builtin_memset (&a, 0x26, sizeof a);
7   return a.i;
8 }
9
10 void __attribute__((noinline))
11 bar (void)
12 {
13   __builtin_memset (&a, 0x36, sizeof a);
14   a.i = 0x36363636;
15   a.j = 0x36373636;
16 }
17
18 int
19 main (void)
20 {
21   int i;
22   if (sizeof (int) != 4 || __CHAR_BIT__ != 8)
23     return 0;
24
25   if (foo () != 0x26262626)
26     __builtin_abort ();
27   for (i = 0; i < sizeof a; i++)
28     if (((char *)&a)[i] != 0x26)
29       __builtin_abort ();
30
31   bar ();
32   if (a.j != 0x36373636)
33     __builtin_abort ();
34   a.j = 0x36363636;
35   for (i = 0; i < sizeof a; i++)
36     if (((char *)&a)[i] != 0x36)
37       __builtin_abort ();
38   return 0;
39 }