OSDN Git Service

2008-11-12 Jack Howarth <howarth@bromo.med.uc.edu>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.c-torture / execute / 20061220-1.c
1 /* PR middle-end/30262 */
2 extern void abort (void);
3
4 int
5 foo (void)
6 {
7   unsigned int x = 0;
8
9   void nested (void)
10   {
11     x = 254;
12   }
13
14   nested ();
15   asm volatile ("" :: "r" (x));
16   asm volatile ("" :: "m" (x));
17   asm volatile ("" :: "mr" (x));
18   asm volatile ("" : "=r" (x) : "0" (x));
19   asm volatile ("" : "=m" (x) : "m" (x));
20   return x;
21 }
22
23 int
24 bar (void)
25 {
26   unsigned int x = 0;
27
28   void nested (void)
29   {
30     asm volatile ("" :: "r" (x));
31     asm volatile ("" :: "m" (x));
32     asm volatile ("" :: "mr" (x));
33     x += 4;
34     asm volatile ("" : "=r" (x) : "0" (x));
35     asm volatile ("" : "=m" (x) : "m" (x));
36   }
37
38   nested ();
39   return x;
40 }
41
42 int
43 baz (void)
44 {
45   unsigned int x = 0;
46
47   void nested (void)
48   {
49     void nested2 (void)
50     {
51       asm volatile ("" :: "r" (x));
52       asm volatile ("" :: "m" (x));
53       asm volatile ("" :: "mr" (x));
54       x += 4;
55       asm volatile ("" : "=r" (x) : "0" (x));
56       asm volatile ("" : "=m" (x) : "m" (x));
57     }
58     nested2 ();
59     nested2 ();
60   }
61
62   nested ();
63   return x;
64 }
65
66 int
67 main (void)
68 {
69   if (foo () != 254 || bar () != 4 || baz () != 8)
70     abort ();
71   return 0;
72 }