aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/array-struct.c
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-10-01 19:07:19 +0000
committerJordan Rose <jordan_rose@apple.com>2012-10-01 19:07:19 +0000
commit75c5e6df52e055537cf92687cf80fe644233381f (patch)
tree0f7a76f156ec8fe9bc34a7f0e97508d490710e0a /test/Analysis/array-struct.c
parentd27a368f4800b447b970b7c438d0fb4da00838dc (diff)
[analyzer] Add a test for PR13927 "offsetof replacement flagged as null deref"
This seems to be legal according to C11 6.5.3.2. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164959 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Analysis/array-struct.c')
-rw-r--r--test/Analysis/array-struct.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Analysis/array-struct.c b/test/Analysis/array-struct.c
index 223069f925..c22f9796e5 100644
--- a/test/Analysis/array-struct.c
+++ b/test/Analysis/array-struct.c
@@ -175,3 +175,11 @@ void f18() {
if (*q) { // no-warning
}
}
+
+
+// [PR13927] offsetof replacement macro flagged as "dereference of a null pointer"
+int offset_of_data_array(void)
+{
+ return ((char *)&(((struct s*)0)->data_array)) - ((char *)0); // no-warning
+}
+