* ubsan.c (ubsan_expand_null_ifn): Use _v1 suffixed type mismatch
[official-gcc.git] / gcc / testsuite / c-c++-common / Wmemset-transposed-args1.c
blobd188d6f7c2b35b6b29db1c572899eb122f8ddac9
1 /* { dg-do compile } */
2 /* { dg-options "-Wall" } */
4 typedef __SIZE_TYPE__ size_t;
5 extern
6 #ifdef __cplusplus
7 "C"
8 #endif
9 void *memset (void *, int, size_t);
10 char buf[1024];
12 void
13 foo ()
15 memset (buf, sizeof buf, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
16 memset (buf, sizeof buf, '\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
17 memset (buf, sizeof buf, L'\0'); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
18 memset (buf, 1, 1 - 1);
19 memset (buf, 1, 0 - 0);
20 memset (buf, 0, 0);
21 memset (buf, '\0', 0);
22 memset (buf, L'\0', 0);
23 memset (buf, 1 - 1, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
24 memset (buf, 0 - 0, 0); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
25 memset (buf, sizeof buf, 0L); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
26 memset (buf, sizeof buf, 0UL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
27 memset (buf, sizeof buf, 0LL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
28 memset (buf, sizeof buf, 0ULL); /* { dg-warning ".memset. used with constant zero length parameter; this could be due to transposed parameters" } */
29 memset (buf, sizeof buf, (int) 0);
30 memset (buf, sizeof buf, -0);