1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
/* PR 85365 - -Wrestrict false positives with -fsanitize=undefined
{ dg-do compile }
{ dg-options "-O2 -Wrestrict -fsanitize=undefined" } */
typedef __SIZE_TYPE__ size_t;
char *strcpy (char *, const char *);
char *strcat (char *, const char *);
size_t strlen (char *);
extern char a[], b[], d[];
size_t t1 (char *g, int i)
{
/* The following exercises the handling in gimple-fold.c. */
strcpy (g + 4, i ? b : a); /* { dg-bogus "\\\[-Wrestrict]" } */
return strlen (g + 4);
}
void t2 (char *g, int i)
{
strcpy (g + 4, i ? b : a); /* { dg-bogus "\\\[-Wrestrict]" } */
strcat (g + 4, d);
}
void t3 (char *g, int i)
{
/* The following exercises the handling in gimple-ssa-warn-restrict.c. */
strcat (g + 4, i ? b : a); /* { dg-bogus "\\\[-Wrestrict]" } */
strcat (g + 4, d);
}
void t4 (char *p, char *q)
{
strcpy (p, q); /* { dg-bogus "\\\[-Wrestrict]" } */
strcat (p, q + 32);
}
|