diff options
Diffstat (limited to 'compiler-rt/test/msan')
-rw-r--r-- | compiler-rt/test/msan/strxfrm.cc | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler-rt/test/msan/strxfrm.cc b/compiler-rt/test/msan/strxfrm.cc new file mode 100644 index 00000000000..b930a6af69c --- /dev/null +++ b/compiler-rt/test/msan/strxfrm.cc @@ -0,0 +1,15 @@ +// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t + +#include <assert.h> +#include <sanitizer/msan_interface.h> +#include <stdlib.h> +#include <string.h> + +int main(void) { + const char *p = "abcdef"; + char q[10]; + size_t n = strxfrm(q, p, sizeof(q)); + assert(n < sizeof(q)); + __msan_check_mem_is_initialized(q, n + 1); + return 0; +} |