PR c/64856
[official-gcc.git] / gcc / testsuite / gcc.dg / 20030826-2.c
blob552c77e7e51a20baa9458aadb40632de60fc45a7
1 /* { dg-do run } */
2 /* { dg-options "-O2 -fomit-frame-pointer" } */
3 /* { dg-options "-O2 -fomit-frame-pointer -march=i386" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
5 extern void abort (void);
6 extern void exit (int);
8 struct S
10 int *a;
11 unsigned char *b, c;
14 int u, v, w;
16 void
17 foo (unsigned short x)
19 u += x;
22 int
23 bar (struct S **x, int *y)
25 w += *y;
26 *y = w + 25;
27 return 0;
30 int
31 baz (struct S **x)
33 struct S *y = *x;
34 unsigned char *a = y->b;
36 foo (*a);
38 if (__builtin_expect (y->c != 0 || y->a == &v, 0))
39 return 1;
41 if (__builtin_expect (*a == 1, 0))
43 int a, b = bar (x, &a);
45 if (a)
46 return b;
49 return 0;
52 int
53 main (void)
55 struct S a, *b = &a;
56 unsigned char c;
58 __builtin_memset (b, 0, sizeof (a));
59 a.a = &v;
60 a.b = &c;
61 if (baz (&b) != 1)
62 abort ();
63 exit (0);