PR middle-end/85602 - -Wsizeof-pointer-memaccess for strncat with size of source
[official-gcc.git] / gcc / testsuite / gcc.dg / pr86114.c
blobf829f0039db87d5e942a02134cd2a51fb56e2a39
1 /* PR tree-optimization/86114 - ICE in gimple_fold_builtin_strlen with
2 an invalid call to strnlen
3 { dg-do compile }
4 { dg-options "-O2" } */
6 typedef __SIZE_TYPE__ size_t;
8 extern char* strcmp (const char*, const char*);
9 extern char* strncmp (const char*, const char*, size_t);
10 extern char* strlen (const char*);
11 extern char* strnlen (const char*, size_t);
12 extern char* strcspn (const char*, const char*);
13 extern char* strspn (const char*, const char*);
14 extern char* strxfrm (const char*, const char*, size_t);
16 char** q;
18 void test_array (const char *s)
20 extern char a[8];
22 q[0] = strcmp (a, s);
23 q[1] = strncmp (a, s, 7);
24 q[2] = strlen (a);
25 q[3] = strnlen (a, 7);
26 q[4] = strcspn (a, s);
27 q[5] = strspn (a, s);
28 q[6] = strxfrm (a, s, 7);
31 void test_pointer (const char *s, const char *t)
33 q[0] = strcmp (s, t);
34 q[1] = strncmp (s, t, 7);
35 q[2] = strlen (s);
36 q[3] = strnlen (s, 7);
37 q[4] = strcspn (s, t);
38 q[5] = strspn (s, t);
39 q[6] = strxfrm (s, s, 7);
42 /* { dg-prune-output "-Wbuiltin-declaration-mismatch" } */