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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
/* PR middle-end/80936 - bcmp, bcopy, and bzero not declared nonnull
Verify that -Wnonnull is issued for calls with constant null pointers
with no optimization.
{ dg-do compile }
{ dg-options "-O0 -Wall" } */
void zero0 (void *p, unsigned n)
{
__builtin_memset (0, 0, n); // { dg-warning "\\\[-Wnonnull]" }
}
void zero1 (void *p, unsigned n)
{
__builtin_bzero (0, n); // { dg-warning "\\\[-Wnonnull]" }
}
void copy0 (void *p, const void *q, unsigned n)
{
__builtin_memcpy (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
}
void copy1 (void *p, const void *q, unsigned n)
{
__builtin_memcpy (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
}
void copy2 (void *p, const void *q, unsigned n)
{
__builtin_bcopy (q, 0, n); // { dg-warning "\\\[-Wnonnull]" }
}
void copy3 (void *p, const void *q, unsigned n)
{
__builtin_bcopy (q, 0, n); // { dg-warning "\\\[-Wnonnull]" }
}
int cmp0 (const void *p, const void *q, unsigned n)
{
return __builtin_memcmp (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
}
int cmp1 (const void *p, const void *q, unsigned n)
{
return __builtin_memcmp (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
}
int cmp2 (const void *p, const void *q, unsigned n)
{
return __builtin_bcmp (0, q, n); // { dg-warning "\\\[-Wnonnull]" }
}
int cmp3 (const void *p, const void *q, unsigned n)
{
return __builtin_bcmp (p, 0, n); // { dg-warning "\\\[-Wnonnull]" }
}
|