diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-03-28 11:21:45 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2014-03-28 11:21:45 +0000 |
commit | 8e032e5d21f3116a6adbcaa7a828903b02392ad6 (patch) | |
tree | 1132236150cdd4df6d63d5840199daad9fadec8b /test | |
parent | 518dbfde26c2eb8435e385b6b688c7019d92d64f (diff) |
[sanitizer] Intercept rand_r.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@205001 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/msan/rand_r.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/msan/rand_r.cc b/test/msan/rand_r.cc new file mode 100644 index 000000000..57574f00b --- /dev/null +++ b/test/msan/rand_r.cc @@ -0,0 +1,18 @@ +// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %t +// RUN: %clangxx_msan -m64 -O0 -g -DUNINIT %s -o %t && not %t 2>&1 | FileCheck %s + +#include <assert.h> +#include <stdio.h> +#include <stdlib.h> + +int main(void) { + unsigned seed; +#ifndef UNINIT + seed = 42; +#endif + int v = rand_r(&seed); + // CHECK: MemorySanitizer: use-of-uninitialized-value + // CHECK: in main{{.*}}rand_r.cc:[[@LINE-2]] + if (v) printf(".\n"); + return 0; +} |