1 /* PR sanitizer/105714 */
2 /* { dg-do run } */
3 /* { dg-skip-if "" { *-*-* } { "*" } { "-Os" } } */
4 /* { dg-shouldfail "asan" } */
5
6 struct A { int x; };
7 struct A b[2];
8 struct A *c = b, *d = b;
9 int e;
10
11 int
12 foo ()
13 {
14 for (e = 0; e < 1; e++)
15 {
16 int i[1];
17 i;
18 }
19 for (int h = 0; h < 3; h++)
20 *c = *d;
21 *c = *(b + 3);
22 return c->x;
23 }
24
25 int
26 main ()
27 {
28 foo ();
29 return 0;
30 }
31
32 /* { dg-output "ERROR: AddressSanitizer: global-buffer-overflow on address.*(\n|\r\n|\r)" } */
33 /* { dg-output "READ of size.*" } */