libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstringop-overflow-13.c
blob021eaae335d1ce5425cb4aaf8c4b1c6f65497428
1 /* PR middle-end/89957 - ICE calling strnlen with an int128_t bound
2 in a known range
3 PR middle-end/89911 - ICE on a call with no arguments to strnlen
4 declared with no prototype
5 { dg-do compile }
6 { dg-options "-O2 -fpermissive -Wall" } */
8 typedef __SIZE_TYPE__ size_t;
10 extern size_t strnlen ();
12 size_t f0 (void)
14 return strnlen (); /* { dg-warning "too few arguments to built-in function 'strnlen'" } */
17 size_t f1 (const char *s)
19 return strnlen (s); /* { dg-warning "too few arguments to built-in function 'strnlen'" } */
22 size_t f2 (const char *s)
24 return strnlen (s, s); /* { dg-warning "\\\[-Wint-conversion]" } */
27 #if __SIZEOF_INT128__ == 16
29 size_t fi128 (const char *s, __int128_t n)
31 if (n < 0)
32 n = 0;
34 /* PR middle-end/89957 */
35 return strnlen (s, n); /* { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" "int128" { target int128 } } */
38 #endif
40 /* { dg-prune-output "\\\[-Wint-conversion]" } */