1 // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
2 // RUN: %clangxx_msan -O0 -g -DPOSITIVE %s -o %t && not %run %t 2>&1 | FileCheck %s
5 #include <sanitizer/msan_interface.h>
8 static void *obstack_chunk_alloc(size_t sz
) {
12 static void obstack_chunk_free(void *p
) {
19 for (size_t sz
= 16; sz
< 0xFFFF; sz
*= 2) {
20 void *p
= obstack_alloc(&obs
, sz
);
22 obstack_grow(&obs
, &data
, sizeof(data
));
23 obstack_blank(&obs
, sz
);
24 obstack_grow(&obs
, &data
, sizeof(data
));
25 obstack_int_grow(&obs
, 13);
26 p
= obstack_finish(&obs
);
29 __msan_check_mem_is_initialized(p
, sizeof(data
));
30 __msan_check_mem_is_initialized(p
, sizeof(data
) + 1);
32 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
33 // CHECK: #0 0x{{.*}} in main{{.*}}obstack.cpp:[[@LINE-3]]
36 obstack_free(&obs
, 0);