Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / unaligned_read_origin.cpp
blobd0cfb2f9b8e77c94e9691218ebd86be9ab1286b3
1 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
2 // RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
3 // RUN: %clangxx_msan -fsanitize-memory-track-origins -O3 %s -o %t && not %run %t >%t.out 2>&1
4 // RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
6 #include <sanitizer/msan_interface.h>
8 int main(int argc, char **argv) {
9 int x;
10 int *volatile p = &x;
11 return __sanitizer_unaligned_load32(p);
12 // CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
13 // CHECK: {{#0 0x.* in main .*unaligned_read_origin.cpp:}}[[@LINE-2]]
14 // CHECK: Uninitialized value was created by an allocation of 'x' in the stack frame
15 // CHECK: {{#0 0x.* in main .*unaligned_read_origin.cpp:}}[[@LINE-6]]