Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gcc.dg / 20030826-2.c
blob6ad7e9a12926abb2723f0042451e34ab12b5ff10
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fomit-frame-pointer" } */
3 /* { dg-options "-O2 -fomit-frame-pointer -march=i386" { target { i?86-*-* && ilp32 } } } */
4 /* { dg-options "-O2 -fomit-frame-pointer -march=i386" { target { x86_64-*-* && ilp32 } } } */
6 extern void abort (void);
7 extern void exit (int);
9 struct S
11 int *a;
12 unsigned char *b, c;
15 int u, v, w;
17 void
18 foo (unsigned short x)
20 u += x;
23 int
24 bar (struct S **x, int *y)
26 w += *y;
27 *y = w + 25;
28 return 0;
31 int
32 baz (struct S **x)
34 struct S *y = *x;
35 unsigned char *a = y->b;
37 foo (*a);
39 if (__builtin_expect (y->c != 0 || y->a == &v, 0))
40 return 1;
42 if (__builtin_expect (*a == 1, 0))
44 int a, b = bar (x, &a);
46 if (a)
47 return b;
50 return 0;
53 int
54 main (void)
56 struct S a, *b = &a;
57 unsigned char c;
59 __builtin_memset (b, 0, sizeof (a));
60 a.a = &v;
61 a.b = &c;
62 if (baz (&b) != 1)
63 abort ();
64 exit (0);