1/* { dg-do run } */ 2/* { dg-skip-if "" { *-*-* } { "*" } { "-O2" } } */ 3/* { dg-options "-fsanitize=object-size" } */ 4 5/* Test that we instrument flexible array members. */ 6 7struct T { int l; int a[]; }; 8struct U { int l; int a[0]; }; 9 10int 11main (void) 12{ 13 volatile int i; 14 struct T *t = (struct T *) __builtin_calloc (sizeof (struct T) 15 + sizeof (int), 1); 16 i = t->a[1]; 17 18 struct U *u = (struct U *) __builtin_calloc (sizeof (struct U) 19 + sizeof (int), 1); 20 i = u->a[1]; 21 return 0; 22} 23 24/* { dg-output "load of address \[^\n\r]* with insufficient space for an object of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */ 25/* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */ 26/* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */ 27/* { dg-output "\[^\n\r]*\\^\[^\n\r]*(\n|\r\n|\r)" } */ 28/* { dg-output "\[^\n\r]*load of address \[^\n\r]* with insufficient space for an object of type 'int'\[^\n\r]*(\n|\r\n|\r)" } */ 29/* { dg-output "\[^\n\r]*note: pointer points here\[^\n\r]*(\n|\r\n|\r)" } */ 30/* { dg-output "\[^\n\r]*\[^\n\r]*(\n|\r\n|\r)" } */ 31/* { dg-output "\[^\n\r]*\\^\[^\n\r]*(\n|\r\n|\r)" } */ 32