20 lines · cpp
1// RUN: %clangxx_msan -O0 %s -o %t && %run %t2 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);11 assert(res == 0);12 __msan_check_mem_is_initialized(&oldstate, sizeof(oldstate));13 14 res = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype);15 assert(res == 0);16 __msan_check_mem_is_initialized(&oldtype, sizeof(oldtype));17 18 return 0;19}20