PR libstdc++/87308 adjust regex used in std::any pretty printer
[official-gcc.git] / gcc / testsuite / c-c++-common / Warray-bounds-6.c
blob6611d5cd916a9d9ef2ad9c0733491ddae9955ebc
1 /* PR tree-optimization/86614 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2 -Warray-bounds" } */
5 extern char *strncpy (char *, const char *, __SIZE_TYPE__);
7 void sink (void *);
9 struct A { char b[17]; } a[2];
11 void g (const char *s, unsigned n)
13 int i = (char *)a[1].b - (char *)a + 1;
14 char *d = a[1].b;
15 /* Ensure the same bug is not diagnosed more than once. */
16 strncpy (d + i, s, n); /* { dg-warning "array subscript \[0-9]+ is outside array bounds of" } */
17 /* { dg-bogus "offset \[0-9]+ is out of the bounds \\\[0, \[0-9]+\\\] of object 'a' with type" "" { target *-*-* } .-1 } */