]> git.proxmox.com Git - rustc.git/blame - src/compiler-rt/test/msan/unpoison_string.cc
New upstream version 1.19.0+dfsg3
[rustc.git] / src / compiler-rt / test / msan / unpoison_string.cc
CommitLineData
92a42be0 1// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t
1a4d82fc 2// RUN: %run %t
92a42be0 3// RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t
1a4d82fc
JJ
4// RUN: %run %t
5
6#include <assert.h>
7#include <string.h>
8#include <sanitizer/msan_interface.h>
9
10int main(int argc, char **argv) {
11 char s[20] = "string";
12 __msan_poison(s, sizeof(s));
13 __msan_unpoison_string(s);
14 assert(__msan_test_shadow(s, sizeof(s)) == strlen("string") + 1);
15 return 0;
16}