brintos

brintos / llvm-project-archived public Read only

0
0
Text · 799 B · ece0503 Raw
22 lines · cpp
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>&13// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out4// RUN: %clangxx_msan -fsanitize-memory-track-origins -O2 %s -o %t && not %run %t >%t.out 2>&15// RUN: FileCheck %s < %t.out && FileCheck %s < %t.out6 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-value16// CHECK:   in main {{.*}}origin-store-long.cpp:[[@LINE-2]]17 18// CHECK:  Uninitialized value was created by a heap allocation19// CHECK:   in main {{.*}}origin-store-long.cpp:[[@LINE-8]]20}21 22