1 /* Limit this to known non-strict alignment targets. */
2 /* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */
3 /* { dg-options "-fsanitize=alignment" } */
5 struct S
{ int a
; char b
; long long c
; short d
[10]; };
6 struct T
{ char a
; long long b
; };
7 struct U
{ char a
; int b
; int c
; long long d
; struct S e
; struct T f
; } __attribute__((packed
));
8 struct V
{ long long a
; struct S b
; struct T c
; struct U u
; } v
;
10 __attribute__((noinline
, noclone
)) void
11 f1 (int *p
, int *q
, char *r
, long long *s
)
20 __attribute__((noinline
, noclone
)) int
26 __attribute__((noinline
, noclone
)) long long
27 f3 (struct S
*p
, int i
)
34 __attribute__((noinline
, noclone
)) long long
43 f1 (&v
.u
.b
, &v
.u
.c
, &v
.u
.a
, &v
.u
.d
);
44 if (f2 (&v
.u
.e
) + f3 (&v
.u
.e
, 4) + f4 (&v
.u
.f
.b
) != 0)
49 /* { dg-output "\.c:(14|15):\[0-9]*: \[^\n\r]*load of misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" } */
50 /* { dg-output "\.c:16:\[0-9]*: \[^\n\r]*load of misaligned address 0x\[0-9a-fA-F]* for type 'long long int', which requires \[48] byte alignment.*" } */
51 /* { dg-output "\.c:(13|16):\[0-9]*: \[^\n\r]*store to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" } */
52 /* { dg-output "\.c:23:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment.*" } */
53 /* { dg-output "\.c:(29|30):\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment.*" } */
54 /* { dg-output "\.c:30:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment.*" } */
55 /* { dg-output "\.c:31:\[0-9]*: \[^\n\r]*member access within misaligned address 0x\[0-9a-fA-F]* for type 'struct S', which requires \[48] byte alignment.*" } */
56 /* { dg-output "\.c:37:\[0-9]*: \[^\n\r]*load of misaligned address 0x\[0-9a-fA-F]* for type 'long long int', which requires \[48] byte alignment" } */