Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / sem_getvalue.cpp
blob07b95cd493a2951117a998403b995b262cb8cd8e
1 // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
3 #include <assert.h>
4 #include <sanitizer/msan_interface.h>
5 #include <semaphore.h>
7 int main(void) {
8 sem_t sem;
9 int res = sem_init(&sem, 0, 42);
10 assert(res == 0);
12 int v;
13 res = sem_getvalue(&sem, &v);
14 assert(res == 0);
15 __msan_check_mem_is_initialized(&v, sizeof(v));
16 assert(v == 42);
18 res = sem_destroy(&sem);
19 assert(res == 0);
21 return 0;