Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/Wstringop-overflow-13.c @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
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 -Wall" } */ | |
7 | |
8 typedef __SIZE_TYPE__ size_t; | |
9 | |
10 extern size_t strnlen (); | |
11 | |
12 size_t f0 (void) | |
13 { | |
14 return strnlen (); /* { dg-warning "too few arguments to built-in function 'strnlen'" } */ | |
15 } | |
16 | |
17 size_t f1 (const char *s) | |
18 { | |
19 return strnlen (s); /* { dg-warning "too few arguments to built-in function 'strnlen'" } */ | |
20 } | |
21 | |
22 size_t f2 (const char *s) | |
23 { | |
24 return strnlen (s, s); /* { dg-warning "\\\[-Wint-conversion]" } */ | |
25 } | |
26 | |
27 #if __SIZEOF_INT128__ == 16 | |
28 | |
29 size_t fi128 (const char *s, __int128_t n) | |
30 { | |
31 if (n < 0) | |
32 n = 0; | |
33 | |
34 /* PR middle-end/89957 */ | |
35 return strnlen (s, n); /* { dg-warning "\\\[-Wbuiltin-declaration-mismatch]" "int128" { target int128 } } */ | |
36 } | |
37 | |
38 #endif | |
39 | |
40 /* { dg-prune-output "\\\[-Wint-conversion]" } */ |