summaryrefslogtreecommitdiffstats
path: root/compiler-rt/test/msan/rand_r.cpp
blob: d83c43a6d85cdcc1a6e48c211d9461c7eb9a3e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// RUN: %clangxx_msan -O0 -g %s -o %t && %run %t
// RUN: %clangxx_msan -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.cpp:[[@LINE-2]]
  if (v) printf(".\n");
  return 0;
}
OpenPOWER on IntegriCloud