// Check that 8-byte store updates origin for the full store range.
// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out
// RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O2 %s -o %t && not %run %t >%t.out 2>&1
// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out

#include <sanitizer/msan_interface.h>

int main() {
  uint64_t *volatile p = new uint64_t;
  uint64_t *volatile q = new uint64_t;
  *p = *q;
  char *z = (char *)p;
  return z[6];
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
// CHECK:   in main {{.*}}origin-store-long.cc:[[@LINE-2]]

// CHECK:  Uninitialized value was created by a heap allocation
// CHECK:   in main {{.*}}origin-store-long.cc:[[@LINE-8]]
}


Update origin for the entire destination range on memory store.
[msan] Update origin for the entire destination range on memory store.

Previously we always stored 4 bytes of origin at the destination address
even for 8-byte (and longer) stores.

This should fix rare missing, or incorrect, origin stacks in MSan reports.


git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@226658 91177308-0d34-0410-b5e6-96231b3b80d8
