1 struct VEC_char_base 2 { 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; 13 }; 14 15 short __attribute__((noinline)) foo(struct VEC_char_base * p,int i)16foo (struct VEC_char_base *p, int i) 17 { 18 short *q; 19 p->u.vec[i] = 0; 20 q = &p->u.vec[16]; 21 *q = 1; 22 return p->u.vec[i]; 23 } 24 25 extern void abort (void); 26 extern void *malloc (__SIZE_TYPE__); 27 28 int main()29main() 30 { 31 struct VEC_char_base *p = malloc (sizeof (struct VEC_char_base) + 256); 32 if (foo (p, 16) != 1) 33 abort (); 34 return 0; 35 } 36