diff options
author | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-09 02:28:12 +0000 |
---|---|---|
committer | Zhongxing Xu <xuzhongxing@gmail.com> | 2009-11-09 02:28:12 +0000 |
commit | c24e9f3a5782096d0bdd9e8aa9f80955a3b60bbd (patch) | |
tree | 1848490e410ba027866b5929bf1feca584130f6a /test | |
parent | 53012f447145bfd5e3a759f069a2bdf2b6705708 (diff) |
Add a test case for CWE-467, and simplify the wording of the warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86504 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/Analysis/sizeofpointer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Analysis/sizeofpointer.c b/test/Analysis/sizeofpointer.c new file mode 100644 index 0000000000..e40c718572 --- /dev/null +++ b/test/Analysis/sizeofpointer.c @@ -0,0 +1,8 @@ +// RUN: clang-cc -analyze -warn-sizeof-pointer -verify %s + +struct s { +}; + +int f(struct s *p) { + return sizeof(p); // expected-warning{{The code calls sizeof() on a pointer type. This can produce an unexpected result.}} +} |