1/* { dg-do run } */
2/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
3/* { dg-options "-fsanitize=undefined" } */
4
5struct S { int a; int b; };
6
7static inline __attribute__((always_inline)) int
8foo (struct S *p)
9{
10  volatile int a;
11  a = p->a; /* OK */
12  return p->b;
13}
14
15int
16bar (void)
17{
18  struct S *p = (struct S *) __builtin_calloc (sizeof (int) + sizeof (int) / 2, 1);
19  return foo (p);
20}
21
22int
23main (void)
24{
25  bar ();
26  return 0;
27}
28
29/* { dg-output "load of address \[^\n\r]* with insufficient space for an object of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */
30/* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */
31/* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */
32/* { dg-output "\[^\n\r]*\\^\[^\n\r]*(\n|\r\n|\r)" } */
33