1 /* PR tree-optimization/83508 - c-c++-common/Wrestrict.c fails since r255836
2 Test to verify that only one of -Wrestrict and -Wstringop-overflow is
3 issued for a problem where either would be appropriate.
5 { dg-options "-O2 -Wrestrict -Wstringop-overflow" } */
7 #define DIFF_MAX __PTRDIFF_MAX__
9 typedef __PTRDIFF_TYPE__
ptrdiff_t;
10 typedef __SIZE_TYPE__
size_t;
14 void f (ptrdiff_t i
, size_t n
)
16 if (i
< DIFF_MAX
- 2 || DIFF_MAX
- 1 > i
)
24 /* The following could very well be diagnosed by -Wstringop-overflow
25 instead but there's no way to verify that only one of the two
26 warnings is issued and the choice of -Wrestrict simply reflects
27 the fact that -Wrestrict runs before -Wstringop-overflow. */
28 __builtin_strncpy (a
+ i
, a
, n
); /* { dg-warning "\\\[-Wrestrict]" } */