1 /* PR tree-optimization/86614 - duplicate -Warray-bounds for a strncpy
2 call with out-of-bounds offset
4 { dg-options "-O2 -Warray-bounds" } */
9 char *strncpy (char *, const char *, __SIZE_TYPE__
);
13 struct A
{ char b
[17]; } a
[2];
15 void g (const char *s
, unsigned n
)
17 int i
= (char *)a
[1].b
- (char *)a
+ 1;
19 /* Verify the bug is diagnosed exactly once, using either form
21 strncpy (d
+ i
, s
, n
); /* { dg-warning "array subscript \[0-9]+ is outside array bounds|offset \[0-9]+ is out of the bounds" } */
22 /* { dg-bogus "offset \[0-9]+ is out of the bounds|array subscript \[0-9]+ is outside array bounds" "" { target *-*-* } .-1 } */