diff options
Diffstat (limited to 'compiler-rt/test/msan/pthread_setcancelstate.cpp')
| -rw-r--r-- | compiler-rt/test/msan/pthread_setcancelstate.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/compiler-rt/test/msan/pthread_setcancelstate.cpp b/compiler-rt/test/msan/pthread_setcancelstate.cpp new file mode 100644 index 00000000000..087c2223a83 --- /dev/null +++ b/compiler-rt/test/msan/pthread_setcancelstate.cpp @@ -0,0 +1,19 @@ +// RUN: %clangxx_msan -O0 %s -o %t && %run %t + +#include <assert.h> +#include <pthread.h> +#include <sanitizer/msan_interface.h> + +int main(void) { + int oldstate; + int oldtype; + int res = pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &oldstate); + assert(res == 0); + __msan_check_mem_is_initialized(&oldstate, sizeof(oldstate)); + + res = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, &oldtype); + assert(res == 0); + __msan_check_mem_is_initialized(&oldtype, sizeof(oldtype)); + + return 0; +} |

