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