* c-c++-common/ubsan/align-7.c: Skip for -flto -fno-fat-lto-objects.
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / align-7.c
blob68c9135fa4272c7babc9f7ce8376c9374410026b
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 -fdump-tree-sanopt-details" } */
4 /* { dg-skip-if "" { *-*-* } { "-flto -fno-fat-lto-objects" } } */
5 /* { dg-shouldfail "ubsan" } */
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;
12 __attribute__((noinline, noclone)) int
13 foo (struct S *p)
15 volatile int i;
16 i = p->a;
17 i = p->a;
18 i = p->a;
19 i = p->a;
20 return p->a;
23 int
24 main ()
26 if (foo (&v.u.e))
27 __builtin_abort ();
28 return 0;
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"} } */
33 /* { dg-final { cleanup-tree-dump "sanopt" } } */