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 -fsanitize-recover=alignment -Wno-address-of-packed-member" } */
6 struct S
{ struct R a
; char b
; long long c
; short d
[10]; };
7 struct T
{ char a
; long long b
; };
8 struct U
{ char a
; int b
; int c
; long long d
; struct S e
; struct T f
; } __attribute__((packed
));
9 struct V
{ long long a
; struct S b
; struct T c
; struct U u
; } v
;
11 __attribute__((noinline
, noclone
)) int
12 bar (int x
, struct R y
, struct R z
)
17 __attribute__((noinline
, noclone
)) int
18 foo (struct S
*p
, struct S
*q
)
20 int i
= bar (0, r
, r
);
21 i
+= bar (1, p
->a
, r
);
22 i
+= bar (2, r
, q
->a
);
29 char *p
= (char *) &v
.u
.e
;
31 asm volatile ("" : "=r" (q
) : "0" (p
));
32 asm volatile ("" : "=r" (r
) : "0" (p
));
38 /* { dg-output "\.c:21:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment.*" } */
39 /* { dg-output "\.c:22:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment" } */