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