PR tree-optimization/81384 - built-in form of strnlen missing
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr41395-2.c
blobc75e963613bb86b84d570851dff0894d2cbede49
1 struct VEC_char_base
3 unsigned num;
4 unsigned alloc;
5 union {
6 short vec[1];
7 struct {
8 int i;
9 int j;
10 int k;
11 } a;
12 } u;
15 short __attribute__((noinline))
16 foo (struct VEC_char_base *p, int i)
18 short *q;
19 p->u.vec[i] = 0;
20 q = &p->u.vec[16];
21 *q = 1;
22 return p->u.vec[i];
25 extern void abort (void);
26 extern void *malloc (__SIZE_TYPE__);
28 int
29 main()
31 struct VEC_char_base *p = malloc (sizeof (struct VEC_char_base) + 256);
32 if (foo (p, 16) != 1)
33 abort ();
34 return 0;