2018-04-09 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / Wrestrict-13.c
blobe4f00c7f2fb2c44cebd30a3856d81c36e2515b8e
1 /* PR tree-optimization/83519 - missing -Wrestrict on an overlapping
2 strcpy to a non-member array
3 { dg-do compile }
4 { dg-options "-O2 -Wall -Wrestrict" } */
6 extern char* stpcpy (char*, const char*); // work around bug 82429
8 struct S { char a[17]; };
10 void f (struct S *p, const char *s)
12 __builtin_strcpy (p->a, "0123456789abcdef");
14 __builtin_strcpy (p->a, p->a + 4); /* { dg-warning "\\\[-Wrestrict]" } */
17 char a[17];
19 void g (const char *s)
21 __builtin_strcpy (a, "0123456789abcdef");
23 __builtin_strcpy (a, a + 4); /* { dg-warning "\\\[-Wrestrict]" } */
26 void h (const char *s)
28 char a[17];
30 __builtin_strcpy (a, "0123456789abcdef");
32 __builtin_strcpy (a, a + 4); /* { dg-warning "\\\[-Wrestrict]" } */
34 extern void sink (void*);
35 sink (a);