c++: ICE with NSDMIs and fn arguments [PR116015]
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / object-size-8.c
blobf09a445f378f55e8c9ff8f66da80a449e18970fb
1 /* { dg-do run } */
2 /* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */
3 /* { dg-options "-fsanitize=undefined" } */
5 struct S { int a; int b; };
7 static inline __attribute__((always_inline)) int
8 foo (struct S *p)
10 volatile int a;
11 a = p->a; /* OK */
12 return p->b;
15 int
16 bar (void)
18 struct S *p = (struct S *) __builtin_calloc (sizeof (int) + sizeof (int) / 2, 1);
19 return foo (p);
22 int
23 main (void)
25 bar ();
26 return 0;
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]*\\^" } */