| 1 | // RUN: %clangxx_msan -O0 -g %s -o %t && %run %t |
|---|---|
| 2 | // RUN: %clangxx_msan -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s |
| 3 | |
| 4 | #include <assert.h> |
| 5 | #include <stdio.h> |
| 6 | #include <stdlib.h> |
| 7 | |
| 8 | int main(void) { |
| 9 | unsigned seed; |
| 10 | #ifndef UNINIT |
| 11 | seed = 42; |
| 12 | #endif |
| 13 | int v = rand_r(seed: &seed); |
| 14 | // CHECK: MemorySanitizer: use-of-uninitialized-value |
| 15 | // CHECK: in main{{.*}}rand_r.cpp:[[@LINE-2]] |
| 16 | if (v) printf(format: ".\n"); |
| 17 | return 0; |
| 18 | } |
| 19 |
