Debian Codegraph @

gcc/testsuite/gcc.dg/Wrestrict-19.c

raw
1 /* PR middle-end/89934 - ICE on a call with fewer arguments to strncpy
2 declared without prototype
3 { dg-do compile }
4 { dg-options "-std=gnu17 -O2 -Wall" } */
5
6 typedef __SIZE_TYPE__ size_t;
7
8 char *strncpy ();
9
10 char* f0 (char *s)
11 {
12 return strncpy ();
13 }
14
15 char* f1 (char *s)
16 {
17 return strncpy (s);
18 }
19
20 char* f2 (char *s)
21 {
22 return strncpy (s, s + 1); /* ICE here. */
23 }
24
25 void f3 (char *s, size_t n, const char *t)
26 {
27 strncpy (s, n, t);
28 strncpy (n, s, t);
29 }
30
31 /* { dg-prune-output "\\\[-Wbuiltin-declaration-mismatch]" }
32 { dg-prune-output "\\\[-Wint-conversion]" } */