111
|
1 /* Limit this to known non-strict alignment targets. */
|
|
2 /* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */
|
145
|
3 /* { dg-options "-O -fsanitize=alignment -fsanitize-undefined-trap-on-error -Wno-address-of-packed-member -fdump-tree-sanopt-details" } */
|
111
|
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-final { scan-tree-dump-times "Optimizing" 4 "sanopt"} } */
|