diff options
Diffstat (limited to 'test/msan/rand_r.cc')
-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 0000000000000..d6bdb1deaa686 --- /dev/null +++ b/test/msan/rand_r.cc @@ -0,0 +1,18 @@ +// RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t +// RUN: %clangxx_msan -m64 -O0 -g -DUNINIT %s -o %t && not %run %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; +} |