Wattributes-10.c: Add -fno-common option on hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / c-c++-common / Wstringop-truncation-3.c
blobba6b7de094b262d86372fd663141f35fab06d6b4
1 /* PR tree-optimization/84228 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wstringop-truncation -O2 -g" } */
5 char *strncpy (char *, const char *, __SIZE_TYPE__);
6 struct S
8 char arr[64];
9 };
11 int
12 foo (struct S *p1, const char *a)
14 int b = 5, c = 6, d = 7;
15 if (a)
16 goto err;
17 strncpy (p1->arr, a, sizeof p1->arr); /* { dg-bogus "specified bound" } */
18 b = 8; c = 9; d = 10;
19 p1->arr[3] = '\0';
20 err:
21 return 0;