1 // RUN: %clang_analyze_cc1 -triple x86_64-unknown-freebsd %s
3 #include "Inputs/system-header-simulator.h"
6 #define NULL ((void *)0)
8 void *malloc(size_t, void *, int);
14 void foo(struct test
*);
16 void test_zeroed(void) {
17 struct test
**list
, *t
;
20 list
= malloc(sizeof(*list
) * 10, NULL
, M_ZERO
);
24 for (i
= 0; i
< 10; i
++) {
28 free(list
); // no-warning
31 void test_nonzero(void) {
32 struct test
**list
, *t
;
35 list
= malloc(sizeof(*list
) * 10, NULL
, 0);
39 for (i
= 0; i
< 10; i
++) {
40 t
= list
[i
]; // expected-warning{{undefined}}
46 void test_indeterminate(int flags
) {
47 struct test
**list
, *t
;
50 list
= malloc(sizeof(*list
) * 10, NULL
, flags
);
54 for (i
= 0; i
< 10; i
++) {
55 t
= list
[i
]; // expected-warning{{undefined}}