23 lines · cpp
1// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&12// RUN: FileCheck %s < %t.out3// RUN: %clangxx_msan -O1 %s -o %t && not %run %t >%t.out 2>&14// RUN: FileCheck %s < %t.out5// RUN: %clangxx_msan -O2 %s -o %t && not %run %t >%t.out 2>&16// RUN: FileCheck %s < %t.out7// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&18// RUN: FileCheck %s < %t.out9 10#include <stdlib.h>11int main(int argc, char **argv) {12 int x;13 int *volatile p = &x;14 int z = *p ? 1 : 0;15 if (z)16 exit(0);17 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value18 // CHECK: {{#0 0x.* in main .*select.cpp:}}[[@LINE-3]]19 20 // CHECK: SUMMARY: MemorySanitizer: use-of-uninitialized-value {{.*select.cpp:.* main}}21 return 0;22}23