-
Notifications
You must be signed in to change notification settings - Fork 79
Description
Consider the testcase below. Even when a function parameter and the passed argument have the exact same types, qualifiers and bounds, the compiler issues a warning.
$ cat my_strcpy.c
extern char *__stpcpy(char *restrict arg_d : itype(restrict _Nt_array_ptr<char>),
const char *restrict arg_s : itype(restrict _Nt_array_ptr<const char>))
: itype(_Nt_array_ptr<char>);
char *strcpy(char *restrict dest : itype(restrict _Nt_array_ptr<char>),
const char *restrict src : itype(restrict _Nt_array_ptr<const char>))
: itype(_Nt_array_ptr<char>)
_Checked
{
__stpcpy(dest, src);
return dest;
}
Compilation output:$ cat my_strcpy_out.txt
sulekha@sulekha-VM:~/Work/checkedc-musl/build$ clang -c ../src/src/string/my_strcpy.c
../src/src/string/my_strcpy.c:12:11: warning: cannot prove argument meets declared bounds for 1st parameter [-Wcheck-bounds-decls-checked-scope]
__stpcpy(dest, src);
^~~~
../src/src/string/my_strcpy.c:12:11: note: (expanded) expected argument bounds are 'bounds(dest, dest + 0)'
../src/src/string/my_strcpy.c:12:11: note: (expanded) inferred bounds are 'bounds(dest, dest + 0)'
__stpcpy(dest, src);
^~~~
../src/src/string/my_strcpy.c:12:17: warning: cannot prove argument meets declared bounds for 2nd parameter [-Wcheck-bounds-decls-checked-scope]
__stpcpy(dest, src);
^~~
../src/src/string/my_strcpy.c:12:17: note: (expanded) expected argument bounds are 'bounds(src, src + 0)'
../src/src/string/my_strcpy.c:12:17: note: (expanded) inferred bounds are 'bounds(src, src + 0)'
__stpcpy(dest, src);
^~~
2 warnings generated.