Update ChangeLog and version files for release
[official-gcc.git] / gcc / testsuite / c-c++-common / asan / misalign-2.c
blob9f400b4c1f26fb641682c570556ab9584bc99e04
1 /* { dg-do run { target { ilp32 || lp64 } } } */
2 /* { dg-options "-O2" } */
3 /* { dg-additional-options "-fno-omit-frame-pointer" { target *-*-darwin* } } */
4 /* { dg-shouldfail "asan" } */
6 struct S { int i; } __attribute__ ((packed));
8 __attribute__((noinline, noclone)) int
9 foo (struct S *s)
11 return s->i;
14 __attribute__((noinline, noclone)) int
15 bar (int *s)
17 return *s;
20 __attribute__((noinline, noclone)) struct S
21 baz (struct S *s)
23 return *s;
26 int
27 main ()
29 struct T { char a[3]; struct S b[3]; char c; } t;
30 int v = 5;
31 struct S *p = t.b;
32 asm volatile ("" : "+rm" (p));
33 p += 3;
34 if (bar (&v) != 5) __builtin_abort ();
35 volatile struct S w = baz (p);
36 return 0;
39 /* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */
40 /* { dg-output "0x\[0-9a-f\]+ at pc 0x\[0-9a-f\]+ bp 0x\[0-9a-f\]+ sp 0x\[0-9a-f\]+\[^\n\r]*(\n|\r\n|\r)" } */
41 /* { dg-output "\[^\n\r]*READ of size 4 at 0x\[0-9a-f\]+ thread T0\[^\n\r]*(\n|\r\n|\r)" } */
42 /* { dg-output " #0 0x\[0-9a-f\]+ +(in _*baz(\[^\n\r]*misalign-2.c:2\[23]|\[^\n\r]*:0)|\[(\])\[^\n\r]*(\n|\r\n|\r)" } */
43 /* { dg-output " #1 0x\[0-9a-f\]+ +(in _*main (\[^\n\r]*misalign-2.c:3\[45]|\[^\n\r]*:0)|\[(\]).*(\n|\r\n|\r)" } */