OSDN Git Service

* c-decl.c (grokfield): Allow typedefs for anonymous structs and
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / pr33619.c
1 /* PR tree-optimization/33619 */
2 /* { dg-do run } */
3 /* { dg-options "-O2" } */
4
5 #ifdef __powerpc__
6 # define REG1 __asm__ ("3")
7 # define REG2 __asm__ ("4")
8 #elif defined __x86_64__
9 # define REG1 __asm__ ("rdi")
10 # define REG2 __asm__ ("rsi")
11 #else
12 # define REG1
13 # define REG2
14 #endif
15
16 static inline void
17 bar (unsigned long x, int y)
18 {
19   register unsigned long p1 REG1 = x;
20   register unsigned long p2 REG2 = y;
21   __asm__ volatile ("" : "=r" (p1), "=r" (p2) : "0" (p1), "1" (p2) : "memory");
22   if (p1 != 0xdeadUL || p2 != 0xbefUL)
23     __builtin_abort ();
24 }
25
26 __attribute__((const, noinline)) int
27 baz (int x)
28 {
29   return x;
30 }
31
32 __attribute__((noinline)) void
33 foo (unsigned long *x, int y)
34 {
35   unsigned long a = *x;
36   bar (a, baz (y));
37 }
38
39 int
40 main (void)
41 {
42   unsigned long a = 0xdeadUL;
43   foo (&a, 0xbefUL);
44   return 0;
45 }