(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
ubsan/
align-7.c
       1  /* Limit this to known non-strict alignment targets.  */
       2  /* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */
       3  /* { dg-options "-O -fsanitize=alignment -fno-sanitize-recover=alignment -Wno-address-of-packed-member -fdump-tree-sanopt-details" } */
       4  /* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
       5  /* { dg-shouldfail "ubsan" } */
       6  
       7  struct S { int a; char b; long long c; short d[10]; };
       8  struct T { char a; long long b; };
       9  struct U { char a; int b; int c; long long d; struct S e; struct T f; } __attribute__((packed));
      10  struct V { long long a; struct S b; struct T c; struct U u; } v;
      11  
      12  __attribute__((noinline, noclone)) int
      13  foo (struct S *p)
      14  {
      15    volatile int i;
      16    i = p->a;
      17    i = p->a;
      18    i = p->a;
      19    i = p->a;
      20    return p->a;
      21  }
      22  
      23  int
      24  main ()
      25  {
      26    if (foo (&v.u.e))
      27      __builtin_abort ();
      28    return 0;
      29  }
      30  
      31  /* { dg-output "\.c:16:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment" } */
      32  /* { dg-final { scan-tree-dump-times "Optimizing" 4 "sanopt"} } */