aboutsummaryrefslogtreecommitdiff
path: root/test/Analysis/malloc-overflow2.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Analysis/malloc-overflow2.c')
-rw-r--r--test/Analysis/malloc-overflow2.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/test/Analysis/malloc-overflow2.c b/test/Analysis/malloc-overflow2.c
index 2e1b1d4d2b24..7c580602e682 100644
--- a/test/Analysis/malloc-overflow2.c
+++ b/test/Analysis/malloc-overflow2.c
@@ -1,4 +1,5 @@
// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -analyzer-checker=alpha.security.MallocOverflow,unix -verify %s
+// RUN: %clang_analyze_cc1 -triple x86_64-unknown-unknown -analyzer-checker=alpha.security.MallocOverflow,unix,optin.portability -DPORTABILITY -verify %s
typedef __typeof__(sizeof(int)) size_t;
extern void *malloc(size_t);
@@ -32,5 +33,8 @@ static int table_build_1(struct table *t) {
}
void *f(int n) {
- return malloc(n * 0 * sizeof(int)); // expected-warning {{Call to 'malloc' has an allocation size of 0 bytes}}
+ return malloc(n * 0 * sizeof(int));
+#ifdef PORTABILITY
+ // expected-warning@-2{{Call to 'malloc' has an allocation size of 0 bytes}}
+#endif
}