struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / support / regression / tests / gcc-torture-execute-20071108-1.c
blob8175c650915b083f0ce4891948b6764e23d4b845
1 /*
2 20071108-1.c from the execute part of the gcc torture suite.
3 */
5 #include <testfwk.h>
7 #ifdef __SDCC
8 #pragma std_c99
9 #endif
11 #include <string.h>
13 /* PR tree-optimization/32575 */
15 struct S
17 void *s1, *s2;
18 unsigned char s3, s4, s5;
21 void *
22 foo (void)
24 static struct S s;
25 return &s;
28 void *
29 bar ()
31 return (void *) 0;
34 struct S *
35 test (void *a, void *b)
37 struct S *p, q;
38 p = foo ();
39 if (p == 0)
41 p = &q;
42 memset (p, 0, sizeof (*p));
44 p->s1 = a;
45 p->s2 = b;
46 if (p == &q)
47 p = 0;
48 return p;
51 void
52 testTortureExecute (void)
54 int a;
55 int b;
56 struct S *z = test ((void *) &a, (void *) &b);
57 if (z == 0 || z->s1 != (void *) &a || z->s2 != (void *) &b || z->s3 || z->s4)
58 ASSERT (0);
59 return;