1 /* PR middle-end/80936 - bcmp, bcopy, and bzero not declared nonnull
2 Verify that with optimization, -Wnonnull is issued for calls with
3 non-constant arguments determined to be null.
5 { dg-options "-O2 -Wall" } */
7 #define NOIPA __attribute__ ((noipa))
9 NOIPA
void zero0 (void *p
, unsigned n
)
12 __builtin_memset (p
, 0, n
); // { dg-warning "\\\[-Wnonnull]" }
15 NOIPA
void zero1 (void *p
, unsigned n
)
18 __builtin_bzero (p
, n
); // { dg-warning "\\\[-Wnonnull]" }
21 NOIPA
void copy0 (void *p
, const void *q
, unsigned n
)
24 __builtin_memcpy (p
, q
, n
); // { dg-warning "\\\[-Wnonnull]" }
27 NOIPA
void copy1 (void *p
, const void *q
, unsigned n
)
30 __builtin_memcpy (p
, q
, n
); // { dg-warning "\\\[-Wnonnull]" }
33 NOIPA
void copy2 (void *p
, const void *q
, unsigned n
)
36 __builtin_bcopy (q
, p
, n
); // { dg-warning "\\\[-Wnonnull]" }
39 NOIPA
void copy3 (void *p
, const void *q
, unsigned n
)
42 __builtin_bcopy (q
, p
, n
); // { dg-warning "\\\[-Wnonnull]" }
45 NOIPA
int cmp0 (const void *p
, const void *q
, unsigned n
)
48 return __builtin_memcmp (p
, q
, n
); // { dg-warning "\\\[-Wnonnull]" }
52 NOIPA
int cmp1 (const void *p
, const void *q
, unsigned n
)
55 return __builtin_memcmp (p
, q
, n
); // { dg-warning "\\\[-Wnonnull]" }
59 NOIPA
int cmp2 (const void *p
, const void *q
, unsigned n
)
62 return __builtin_bcmp (p
, q
, n
); // { dg-warning "\\\[-Wnonnull]" }
66 NOIPA
int cmp3 (const void *p
, const void *q
, unsigned n
)
69 return __builtin_bcmp (p
, q
, n
); // { dg-warning "\\\[-Wnonnull]" }