(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
torture/
pr57748-3.c
       1  /* PR middle-end/57748 */
       2  /* { dg-do run } */
       3  /* wrong code in expand_expr_real_1.  */
       4  
       5  #include <stdlib.h>
       6  
       7  extern void abort (void);
       8  
       9  typedef long long V
      10    __attribute__ ((vector_size (2 * sizeof (long long)), may_alias));
      11  
      12  typedef struct S { V a; V b[0]; } P __attribute__((aligned (1)));
      13  
      14  struct __attribute__((packed)) T { char c; P s; };
      15  
      16  void __attribute__((noinline, noclone))
      17  check (P *p)
      18  {
      19    if (p->b[0][0] != 3 || p->b[0][1] != 4)
      20      abort ();
      21  }
      22  
      23  void __attribute__((noinline, noclone))
      24  foo (struct T *t)
      25  {
      26    V a = { 3, 4 };
      27    t->s.b[0] = a;
      28  }
      29  
      30  int
      31  main ()
      32  {
      33    struct T *t = (struct T *) calloc (128, 1);
      34  
      35    foo (t);
      36    check (&t->s);
      37  
      38    free (t);
      39    return 0;
      40  }