1 void abort(void);
2 void exit(int);
3 struct baz
4 {
5 char a[17];
6 char b[3];
7 unsigned int c;
8 unsigned int d;
9 };
10
foo(struct baz * p,unsigned int c,unsigned int d)11 void foo(struct baz *p, unsigned int c, unsigned int d)
12 {
13 __builtin_memcpy (p->b, "abc", 3);
14 p->c = c;
15 p->d = d;
16 }
17
bar(struct baz * p,unsigned int c,unsigned int d)18 void bar(struct baz *p, unsigned int c, unsigned int d)
19 {
20 ({ void *s = (p);
21 __builtin_memset (s, '\0', sizeof (struct baz));
22 s; });
23 __builtin_memcpy (p->a, "01234567890123456", 17);
24 __builtin_memcpy (p->b, "abc", 3);
25 p->c = c;
26 p->d = d;
27 }
28
main()29 int main()
30 {
31 struct baz p;
32 foo(&p, 71, 18);
33 if (p.c != 71 || p.d != 18)
34 abort();
35 bar(&p, 59, 26);
36 if (p.c != 59 || p.d != 26)
37 abort();
38 exit(0);
39 }
40