1// RUN: %clang_msan -std=c99 -O0 -g %s -o %t && %run %t
2
3// strerror_r under a weird set of circumstances can be redirected to
4// __xpg_strerror_r. Test that MSan handles this correctly.
5
6#define _POSIX_C_SOURCE 200112
7#include <assert.h>
8#include <stdio.h>
9#include <string.h>
10#include <errno.h>
11
12int main() {
13 char buf[1000];
14 int res = strerror_r(EINVAL, buf: buf, buflen: sizeof(buf));
15 assert(!res);
16 volatile int z = strlen(s: buf);
17 return 0;
18}
19

source code of compiler-rt/test/msan/strerror_r-non-gnu.c