1 // RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
2 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-NO-ORIGINS < %t.out
4 // RUN: %clangxx_msan -fsanitize-memory-track-origins -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
5 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ORIGINS < %t.out
7 // RUN: %clangxx_msan -fsanitize-memory-track-origins=2 -m64 -O0 -g %s -o %t && %run %t >%t.out 2>&1
8 // RUN: FileCheck %s --check-prefix=CHECK --check-prefix=CHECK-ORIGINS < %t.out
10 #include <sanitizer/msan_interface.h>
13 char *p
= new char[16];
14 __msan_print_shadow(p
, 1);
15 __msan_print_shadow(p
+1, 1);
16 __msan_print_shadow(p
+3, 1);
17 __msan_print_shadow(p
+15, 1);
18 __msan_print_shadow(p
, 0);
21 __msan_print_shadow(&x
, 3);
25 // CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
26 // CHECK-NO-ORIGINS: 0x{{.*}}: ff...... ........ ........ ........
27 // CHECK-ORIGINS: 0x{{.*}}: ff...... ........ ........ ........ |A . . .|
28 // CHECK-ORIGINS: Origin A (origin_id {{.*}}):
30 // CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
31 // CHECK-NO-ORIGINS: 0x{{.*}}: ..ff.... ........ ........ ........
32 // CHECK-ORIGINS: 0x{{.*}}: ..ff.... ........ ........ ........ |A . . .|
33 // CHECK-ORIGINS: Origin A (origin_id {{.*}}):
35 // CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
36 // CHECK-NO-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........
37 // CHECK-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........ |A . . .|
38 // CHECK-ORIGINS: Origin A (origin_id {{.*}}):
40 // CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 1 bytes:
41 // CHECK-NO-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........
42 // CHECK-ORIGINS: 0x{{.*}}: ......ff ........ ........ ........ |A . . .|
43 // CHECK-ORIGINS: Origin A (origin_id {{.*}}):
45 // CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 0 bytes:
47 // CHECK: Shadow map of [0x{{.*}}, 0x{{.*}}), 3 bytes:
48 // CHECK-NO-ORIGINS: 0x{{.*}}: 000000.. ........ ........ ........
49 // CHECK-ORIGINS: 0x{{.*}}: 000000.. ........ ........ ........ |. . . .|