PR tree-optimization/81384 - built-in form of strnlen missing
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20071108-1.c
blobf5460579b6b70c2dadcc249f20c601d621f1b2bc
1 /* PR tree-optimization/32575 */
3 extern void abort (void);
5 struct S
7 void *s1, *s2;
8 unsigned char s3, s4, s5;
9 };
11 __attribute__ ((noinline))
12 void *
13 foo (void)
15 static struct S s;
16 return &s;
19 __attribute__ ((noinline))
20 void *
21 bar ()
23 return (void *) 0;
26 __attribute__ ((noinline))
27 struct S *
28 test (void *a, void *b)
30 struct S *p, q;
31 p = foo ();
32 if (p == 0)
34 p = &q;
35 __builtin_memset (p, 0, sizeof (*p));
37 p->s1 = a;
38 p->s2 = b;
39 if (p == &q)
40 p = 0;
41 return p;
44 int
45 main (void)
47 int a;
48 int b;
49 struct S *z = test ((void *) &a, (void *) &b);
50 if (z == 0 || z->s1 != (void *) &a || z->s2 != (void *) &b || z->s3 || z->s4)
51 abort ();
52 return 0;