brintos

brintos / llvm-project-archived public Read only

0
0
Text · 370 B · 638bdbe Raw
19 lines · cpp
1// RUN: %clangxx_msan -O2 %s -o %t && \2// RUN:     not %run %t 2>&1 | FileCheck %s3 4#include <stdlib.h>5 6int *p;7 8int main() {9  for (int i = 0; i < 3; i++) {10    int x;11    if (i == 0)12      x = 0;13    p = &x;14  }15  return *p; // BOOM16  // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value17  // CHECK:  #0 0x{{.*}} in main {{.*}}loop-scope.cpp:[[@LINE-2]]18}19