From 20f0178a232029bea7f34adecb6e5bdd6fada483 Mon Sep 17 00:00:00 2001 From: Zhongxing Xu Date: Mon, 24 Nov 2008 02:19:49 +0000 Subject: [PATCH] Add test case for out-of-bound memory access checking. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59931 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/outofbound.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 test/Analysis/outofbound.c diff --git a/test/Analysis/outofbound.c b/test/Analysis/outofbound.c new file mode 100644 index 0000000000..17608ff168 --- /dev/null +++ b/test/Analysis/outofbound.c @@ -0,0 +1,6 @@ +// RUN: clang -checker-simple -analyzer-store-region -verify %s + +char f1() { + char* s = "abcd"; + return s[4]; // expected-warning{{Load or store into an out-of-bound memory position.}} +} -- 2.40.0