diff options
Diffstat (limited to 'compiler-rt/test/msan/unpoison_string.cpp')
| -rw-r--r-- | compiler-rt/test/msan/unpoison_string.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/compiler-rt/test/msan/unpoison_string.cpp b/compiler-rt/test/msan/unpoison_string.cpp new file mode 100644 index 00000000000..84d95283353 --- /dev/null +++ b/compiler-rt/test/msan/unpoison_string.cpp @@ -0,0 +1,16 @@ +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t +// RUN: %run %t +// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t +// RUN: %run %t + +#include <assert.h> +#include <string.h> +#include <sanitizer/msan_interface.h> + +int main(int argc, char **argv) { + char s[20] = "string"; + __msan_poison(s, sizeof(s)); + __msan_unpoison_string(s); + assert(__msan_test_shadow(s, sizeof(s)) == strlen("string") + 1); + return 0; +} |

