(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
ubsan/
align-1.c
       1  /* { dg-do run } */
       2  /* { dg-options "-fsanitize=undefined -fno-sanitize-recover=undefined" } */
       3  
       4  struct S { int a; char b; long long c; short d[10]; };
       5  struct T { char a; long long b; };
       6  struct U { char a; int b; int c; long long d; struct S e; struct T f; };
       7  struct V { long long a; struct S b; struct T c; struct U u; } v;
       8  
       9  __attribute__((noinline, noclone)) void
      10  f1 (int *p, int *q, char *r, long long *s)
      11  {
      12    *p = *q + *r + *s;
      13  }
      14  
      15  
      16  __attribute__((noinline, noclone)) int
      17  f2 (struct S *p)
      18  {
      19    return p->a;
      20  }
      21  
      22  __attribute__((noinline, noclone)) long long
      23  f3 (struct S *p, int i)
      24  {
      25    return p->c + p->d[1] + p->d[i];
      26  }
      27  
      28  __attribute__((noinline, noclone)) long long
      29  f4 (long long *p)
      30  {
      31    return *p;
      32  }
      33  
      34  int
      35  main ()
      36  {
      37    f1 (&v.u.b, &v.u.c, &v.u.a, &v.u.d);
      38    if (f2 (&v.u.e) + f3 (&v.u.e, 4) + f4 (&v.u.f.b) != 0)
      39      __builtin_abort ();
      40    return 0;
      41  }