bolt/deps/llvm-18.1.8/compiler-rt/test/msan/eventfd.cpp

22 lines
411 B
C++
Raw Normal View History

2025-02-14 19:21:04 +01:00
/* RUN: %clangxx_msan -O0 %s -o %t && %run %t 2>&1
REQUIRES: target={{.*(linux|freebsd).*}}
*/
#include <assert.h>
#include <sys/eventfd.h>
#include <sanitizer/msan_interface.h>
int main(int argc, char *argv[]) {
int efd = eventfd(42, 0);
assert(efd >= 0);
eventfd_t v;
int ret = eventfd_read(efd, &v);
assert(ret == 0);
__msan_check_mem_is_initialized(&v, sizeof(v));
assert(v == 42);
}