1 /* PR tree-optimization/83655 - ICE on an invalid call to memcpy declared
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.
7 { dg-options "-O2 -fpermissive -Wrestrict" } */
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]" } */