Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/Wrestrict-13.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
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" } */ | |
5 | |
6 extern char* stpcpy (char*, const char*); // work around bug 82429 | |
7 | |
8 struct S { char a[17]; }; | |
9 | |
10 void f (struct S *p, const char *s) | |
11 { | |
12 __builtin_strcpy (p->a, "0123456789abcdef"); | |
13 | |
14 __builtin_strcpy (p->a, p->a + 4); /* { dg-warning "\\\[-Wrestrict]" } */ | |
15 } | |
16 | |
17 char a[17]; | |
18 | |
19 void g (const char *s) | |
20 { | |
21 __builtin_strcpy (a, "0123456789abcdef"); | |
22 | |
23 __builtin_strcpy (a, a + 4); /* { dg-warning "\\\[-Wrestrict]" } */ | |
24 } | |
25 | |
26 void h (const char *s) | |
27 { | |
28 char a[17]; | |
29 | |
30 __builtin_strcpy (a, "0123456789abcdef"); | |
31 | |
32 __builtin_strcpy (a, a + 4); /* { dg-warning "\\\[-Wrestrict]" } */ | |
33 | |
34 extern void sink (void*); | |
35 sink (a); | |
36 } |