Skip analyzer strndup test on hppa*-*-hpux*
[official-gcc.git] / gcc / testsuite / gcc.dg / Wrestrict-5.c
blob4ea9176f1f51ebb7c2f1f9cea03f093747db0456
1 /* PR tree-optimization/83655 - ICE on an invalid call to memcpy declared
2 with no prototype
3 Test to verify that valid calls to common restrict-qualified built-in
4 functions declared with no prototype are checked for overlap, and that
5 invalid calls are ignored.
6 { dg-do compile }
7 { dg-options "-O2 -fpermissive -Wrestrict" } */
9 void* memcpy ();
10 char* strncpy ();
12 #if __cplusplus
13 } /* extern "C" */
14 #endif
16 void test_memcpy_warn (char *d)
18 memcpy (d, d + 2, 3); /* { dg-warning "accessing 3 bytes at offsets 0 and 2 overlaps 1 byte at offset 2" } */
21 void test_memcpy_nowarn (char *d)
23 memcpy (d, d + 2, "");
27 void test_strncpy_warn (char *d)
29 strncpy (d + 1, d + 3, 5); /* { dg-warning "accessing 5 bytes at offsets 1 and 3 overlaps between 1 and 2 bytes at offset 3" } */
32 void test_strncpy_nowarn (char *d)
34 strncpy (d + 1, d + 3, "");
37 /* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch]" }
38 { dg-prune-output "\\\[-Wint-conversion]" } */