diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2015-01-07 19:55:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2015-01-07 19:55:37 +0000 |
commit | ca9211ecdede9bdedb812b2243a4abdb8dacd1b9 (patch) | |
tree | 9b19e801150082c33e9152275829a6ce90614b55 /test/msan/strerror_r-non-gnu.c | |
parent | 8ef50bf3d1c287b5013c3168de77a462dfce3495 (diff) |
Diffstat (limited to 'test/msan/strerror_r-non-gnu.c')
-rw-r--r-- | test/msan/strerror_r-non-gnu.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/msan/strerror_r-non-gnu.c b/test/msan/strerror_r-non-gnu.c new file mode 100644 index 0000000000000..d55bf42ef11ee --- /dev/null +++ b/test/msan/strerror_r-non-gnu.c @@ -0,0 +1,18 @@ +// RUN: %clang_msan -std=c99 -O0 -g %s -o %t && %run %t + +// strerror_r under a weird set of circumstances can be redirected to +// __xpg_strerror_r. Test that MSan handles this correctly. + +#define _POSIX_C_SOURCE 200112 +#include <assert.h> +#include <stdio.h> +#include <string.h> +#include <errno.h> + +int main() { + char buf[1000]; + int res = strerror_r(EINVAL, buf, sizeof(buf)); + assert(!res); + volatile int z = strlen(buf); + return 0; +} |