PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / c-c++-common / pr54486.c
blob8c311f8e7f4bd700362b2bf072df585757b1c061
1 /* PR middle-end/54486 */
2 /* { dg-do compile } */
3 /* { dg-options "-Wformat" } */
4 /* { dg-skip-if "no POSIX printf" { *-*-mingw* } } */
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 typedef __SIZE_TYPE__ size_t;
10 extern int printf (const char *, ...);
11 extern size_t strspn (const char *, const char *);
12 extern size_t strcspn (const char *, const char *);
13 extern size_t strlen (const char *);
14 #ifdef __cplusplus
16 #endif
18 void
19 foo (void)
21 printf ("%zu\n", strspn ("abc", "abcdefg"));
22 printf ("%zu\n", (size_t) strspn ("abc", "abcdefg"));
23 printf ("%zu\n", __builtin_strspn ("abc", "abcdefg"));
24 printf ("%zu\n", (size_t) __builtin_strspn ("abc", "abcdefg"));
25 printf ("%zu\n", strcspn ("abc", "abcdefg"));
26 printf ("%zu\n", (size_t) strcspn ("abc", "abcdefg"));
27 printf ("%zu\n", __builtin_strcspn ("abc", "abcdefg"));
28 printf ("%zu\n", (size_t) __builtin_strcspn ("abc", "abcdefg"));
29 printf ("%zu\n", strlen ("abc"));
30 printf ("%zu\n", (size_t) strlen ("abc"));
31 printf ("%zu\n", __builtin_strlen ("abc"));
32 printf ("%zu\n", (size_t) __builtin_strlen ("abc"));