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 |
5 | |
6 | #include <sanitizer/msan_interface.h> |
7 | |
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]] |
16 | } |
17 | |