1 // RUN: %clangxx_msan -std=c++11 -O0 %s -o %t && %run %t
2 // RUN: %clangxx_msan -std=c++11 -fsanitize-memory-track-origins -O0 %s -o %t && %run %t
7 #include <sanitizer/msan_interface.h>
9 int main(int argc
, char *argv
[]) {
10 FILE *f
= fopen(argv
[0], "r");
16 assert(f
->_IO_read_end
> f
->_IO_read_base
);
17 __msan_check_mem_is_initialized(f
->_IO_read_end
, f
->_IO_read_end
- f
->_IO_read_base
);
20 sprintf(tmp_file
, "%s.write.tmp", argv
[0]);
22 f
= fopen(tmp_file
, "w+");
27 assert(f
->_IO_write_end
> f
->_IO_write_base
);
28 __msan_check_mem_is_initialized(f
->_IO_write_end
, f
->_IO_write_end
- f
->_IO_write_base
);