(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.c-torture/
execute/
pr41395-1.c
       1  struct VEC_char_base
       2  {
       3    unsigned num;
       4    unsigned alloc;
       5    short vec[1];
       6  };
       7  
       8  short __attribute__((noinline))
       9  foo (struct VEC_char_base *p, int i)
      10  {
      11    short *q;
      12    p->vec[i] = 0;
      13    q = &p->vec[8];
      14    *q = 1;
      15    return p->vec[i];
      16  }
      17  
      18  extern void abort (void);
      19  extern void *malloc (__SIZE_TYPE__);
      20  
      21  int
      22  main()
      23  {
      24    struct VEC_char_base *p = malloc (sizeof (struct VEC_char_base) + 256);
      25    if (foo (p, 8) != 1)
      26      abort ();
      27    return 0;
      28  }