PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / pr81345.c
blob14661f5dac34a1d0247e083036f609fbb424ca98
1 /* PR other/81345 - -Wall resets -Wstringop-overflow to 1 from the default 2
2 { dg-do compile }
3 { dg-options "-O2 -Wall -Wno-array-bounds" } */
5 char a[3];
7 void f (const char *s)
9 __builtin_strncpy (a, s, sizeof a + 1); /* { dg-warning "\\\[-Wstringop-overflow=]" } */
12 struct S { char a[3]; int i; };
14 void g (struct S *d, const char *s)
16 __builtin_strncpy (d->a, s, sizeof d->a + 1); /* { dg-warning "\\\[-Wstringop-overflow=]" } */