* c-c++-common/ubsan/align-7.c: Skip for -flto -fno-fat-lto-objects.
[official-gcc.git] / gcc / testsuite / c-c++-common / ubsan / object-size-8.c
blobee0945b902c4ac5382f0bdf9fb6b3c04e4564a16
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]*\\^\[^\n\r]*(\n|\r\n|\r)" } */