1// RUN: %clangxx_msan -O0 %s -o %t && %run %t
2
3#include <assert.h>
4#include <pthread.h>
5#include <sanitizer/msan_interface.h>
6
7int main(void) {
8 int oldstate;
9 int oldtype;
10 int res = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, oldstate: &oldstate);
11 assert(res == 0);
12 __msan_check_mem_is_initialized(x: &oldstate, size: sizeof(oldstate));
13
14 res = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, oldtype: &oldtype);
15 assert(res == 0);
16 __msan_check_mem_is_initialized(x: &oldtype, size: sizeof(oldtype));
17
18 return 0;
19}
20

source code of compiler-rt/test/msan/pthread_setcancelstate.cpp