Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/Wstringop-overflow-10.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 /* { dg-do compile } */ | |
2 /* { dg-options "-O2 -Wstringop-overflow" } */ | |
3 | |
4 void | |
5 foo (char *a) | |
6 { | |
7 char b[16] = "abcdefg"; | |
8 __builtin_strncpy (a, b, __builtin_strlen (b)); /* { dg-warning "specified bound depends on the length of the source argument" } */ | |
9 } | |
10 | |
11 void | |
12 bar (char *a) | |
13 { | |
14 char b[16] = "abcdefg"; | |
15 __builtin_strncpy (a, b, __builtin_strnlen (b, 8)); /* { dg-warning "specified bound depends on the length of the source argument" } */ | |
16 } | |
17 | |
18 void | |
19 baz (char *a) | |
20 { | |
21 char b[16] = "abcdefg"; | |
22 __builtin_strncpy (a, b, __builtin_strnlen (b, 7)); /* { dg-bogus "specified bound depends on the length of the source argument" } */ | |
23 } | |
24 | |
25 void fill (char *); | |
26 | |
27 void | |
28 qux (char *a) | |
29 { | |
30 char b[16]; | |
31 fill (b); | |
32 __builtin_memcpy (b, "abcdefg", 7); | |
33 __builtin_strncpy (a, b, __builtin_strnlen (b, 8)); /* { dg-bogus "specified bound depends on the length of the source argument" } */ | |
34 } |