Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / gcc.dg / 20031202-1.c
blobac443a284250251b563606f46e07451055a761b3
1 /* { dg-do run } */
2 /* { dg-options "-O2" } */
3 /* { dg-options "-O2 -mtune=i686" { target i?86-*-* } } */
4 /* { dg-skip-if "" { i?86-*-* } { "-m64" } { "" } } */
6 extern void abort (void);
7 extern void exit (int);
9 struct A { char p[6]; } __attribute__((packed));
10 struct B {
11 struct A a;
12 void * const b;
13 struct A const * const c;
14 struct A const *d;
17 char v;
19 int __attribute__((noinline))
20 foo (struct B *b)
22 int i;
23 for (i = 0; i < 6; ++i)
24 if (b->a.p[i])
25 abort ();
26 if (b->b != &v || b->c || b->d)
27 abort ();
28 return 12;
31 int __attribute__((noinline))
32 bar (void *x)
34 __asm __volatile ("" : "=r" (x) : "0" (x));
35 struct B y = { .b = x, .c = (void *) 0 };
36 return foo (&y) + 1;
39 int
40 main (void)
42 if (bar (&v) != 13)
43 abort ();
44 exit (0);