| 1 | // RUN: %clangxx_msan -O2 %s -o %t && \ |
|---|---|
| 2 | // RUN: not %run %t 2>&1 | FileCheck %s |
| 3 | |
| 4 | #include <stdlib.h> |
| 5 | |
| 6 | int *p; |
| 7 | |
| 8 | int 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; // BOOM |
| 16 | // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value |
| 17 | // CHECK: #0 0x{{.*}} in main {{.*}}loop-scope.cpp:[[@LINE-2]] |
| 18 | } |
| 19 |
