| 1 |
/* Limit this to known non-strict alignment targets. */ |
| 2 |
/* { dg-do run { target { i?86-*-linux* x86_64-*-linux* } } } */ |
| 3 |
/* { dg-options "-O2 -fsanitize=alignment -fsanitize-recover=alignment" } */ |
| 4 |
|
| 5 |
__attribute__((noinline, noclone)) void |
| 6 |
foo (void *p, const void *q) |
| 7 |
{ |
| 8 |
*(long int *) p = *(const long int *) q; |
| 9 |
} |
| 10 |
|
| 11 |
int |
| 12 |
main () |
| 13 |
{ |
| 14 |
struct S { long c; char f[64]; char d; char e[2 * sizeof (long)]; char g[64]; } s; |
| 15 |
__builtin_memset (&s, '\0', sizeof s); |
| 16 |
foo (&s.e[0], &s.e[sizeof (long)]); |
| 17 |
return 0; |
| 18 |
} |
| 19 |
|
| 20 |
/* { dg-output "\.c:8:\[0-9]*: \[^\n\r]*load of misaligned address 0x\[0-9a-fA-F]* for type 'const long int', which requires \[48] byte alignment.*" } */ |
| 21 |
/* { dg-output "\.c:8:\[0-9]*: \[^\n\r]*store to misaligned address 0x\[0-9a-fA-F]* for type 'long int', which requires \[48] byte alignment" } */ |