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);
13 void foo(struct test
*);
15 void test_zeroed(void) {
16 struct test
**list
, *t
;
19 list
= malloc(sizeof(*list
) * 10, NULL
, M_ZERO
);
23 for (i
= 0; i
< 10; i
++) {
27 free(list
); // no-warning
30 void test_nonzero(void) {
31 struct test
**list
, *t
;
34 list
= malloc(sizeof(*list
) * 10, NULL
, 0);
38 for (i
= 0; i
< 10; i
++) {
39 t
= list
[i
]; // expected-warning{{undefined}}
45 void test_indeterminate(int flags
) {
46 struct test
**list
, *t
;
49 list
= malloc(sizeof(*list
) * 10, NULL
, flags
);
53 for (i
= 0; i
< 10; i
++) {
54 t
= list
[i
]; // expected-warning{{undefined}}