1// Check that 8-byte store updates origin for the full store range.
2// RUN: %clangxx_msan -fsanitize-memory-track-origins -O0 %s -o %t && not %run %t >%t.out 2>&1
3// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
4// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&1
5// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
6
7#include <sanitizer/msan_interface.h>
8
9int main() {
10 uint64_t *volatile p = new uint64_t;
11 uint64_t *volatile q = new uint64_t;
12 *p = *q;
13 char *z = (char *)p;
14 return z[6];
15// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
16// CHECK: in main {{.*}}origin-store-long.cpp:[[@LINE-2]]
17
18// CHECK: Uninitialized value was created by a heap allocation
19// CHECK: in main {{.*}}origin-store-long.cpp:[[@LINE-8]]
20}
21
22

source code of compiler-rt/test/msan/origin-store-long.cpp