1// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
2
3#define _BSD_SOURCE
4#include <assert.h>
5#include <stdlib.h>
6
7#include <sanitizer/msan_interface.h>
8
9int main(void) {
10 double x[4];
11 int ret = getloadavg(loadavg: x, nelem: 3);
12 assert(ret > 0);
13 assert(ret <= 3);
14 assert(__msan_test_shadow(x, sizeof(double) * ret) == -1);
15 assert(__msan_test_shadow(&x[ret], sizeof(double)) == 0);
16}
17

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