xref: /llvm-project/clang/test/Analysis/string_notnullterm.c (revision 4dfa0216ba7849fde270f27e2358d4327fac988d)
1 // RUN: %clang_analyze_cc1 -verify %s -Wno-null-dereference \
2 // RUN:   -analyzer-checker=core \
3 // RUN:   -analyzer-checker=unix.cstring.NotNullTerminated \
4 // RUN:   -analyzer-checker=debug.ExprInspection
5 
6 char *strcpy(char *restrict s1, const char *restrict s2);
7 
8 void strcpy_fn(char *x) {
9   strcpy(x, (char*)&strcpy_fn); // expected-warning{{Argument to string copy function is the address of the function 'strcpy_fn', which is not a null-terminated string}}
10 }
11