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 -Wall -Wno-unused-variable -std=c++11" }
5 typedef const long int L;
6 struct S { long int l; char buf[1 + sizeof (int) + sizeof (L)]; } s;
7 struct T { char a; int b; long int c; } __attribute__((packed));
8 struct U { long int a; struct T b; } u;
13 int *p = (int *) &s.buf[1];
14 L *l = (L *) &s.buf[1 + sizeof(int)];
20 // Try an rvalue reference.
23 // Don't evaluate the reference initializer twice.
38 // { dg-output "\.C:16:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" }
39 // { dg-output "\.C:17:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" }
40 // { dg-output "\.C:18:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'const L', which requires \[48] byte alignment.*" }
41 // { dg-output "\.C:21:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" }
42 // { dg-output "\.C:32:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" }
43 // { dg-output "\.C:33:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment.*" }
44 // { dg-output "\.C:34:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'const L', which requires \[48] byte alignment.*" }
45 // { dg-output "\.C:35:\[0-9]*:\[\^\n\r]*reference binding to misaligned address 0x\[0-9a-fA-F]* for type 'int', which requires 4 byte alignment" }