PR tree-optimization/81384 - built-in form of strnlen missing
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20000703-1.c
blob55bdf74df227f8730a7203ed1b0ec62fae59b0aa
1 void abort(void);
2 void exit(int);
3 struct baz
5 char a[17];
6 char b[3];
7 unsigned int c;
8 unsigned int d;
9 };
11 void foo(struct baz *p, unsigned int c, unsigned int d)
13 __builtin_memcpy (p->b, "abc", 3);
14 p->c = c;
15 p->d = d;
18 void bar(struct baz *p, unsigned int c, unsigned int d)
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;
29 int main()
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);