Skip to content

Commit cf66f50

Browse files
committed
Test track-origins=1 for zero_alloc.cpp
1 parent aad1b12 commit cf66f50

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

compiler-rt/test/msan/zero_alloc.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// RUN: %clang_msan -Wno-alloc-size -fsanitize-recover=memory %s -o %t && not %run %t 2>&1 \
22
// RUN: | FileCheck %s --check-prefix=CHECK
3+
// RUN: %clang_msan -Wno-alloc-size -fsanitize-recover=memory -fsanitize-memory-track-origins=1 %s -o %t && not %run %t 2>&1 \
4+
// RUN: | FileCheck %s --check-prefixes=CHECK,DISCOUNT
35
// RUN: %clang_msan -Wno-alloc-size -fsanitize-recover=memory -fsanitize-memory-track-origins=2 %s -o %t && not %run %t 2>&1 \
46
// RUN: | FileCheck %s --check-prefixes=CHECK,ORIGINS
57

@@ -13,7 +15,7 @@ int main(int argc, char **argv) {
1315
printf("Content of p1 is: %d\n", *p1);
1416
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
1517
// CHECK: {{#0 0x.* in main .*zero_alloc.cpp:}}[[@LINE-2]]
16-
// ORIGINS: Uninitialized value is outside of heap allocation
18+
// DISCOUNT,ORIGINS: Uninitialized value is outside of heap allocation
1719
free(p1);
1820
}
1921

@@ -23,7 +25,7 @@ int main(int argc, char **argv) {
2325
printf("Content of p2 is: %d\n", *p2);
2426
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
2527
// CHECK: {{#0 0x.* in main .*zero_alloc.cpp:}}[[@LINE-2]]
26-
// ORIGINS: Uninitialized value is outside of heap allocation
28+
// DISCOUNT,ORIGINS: Uninitialized value is outside of heap allocation
2729
free(p2);
2830
}
2931

@@ -33,6 +35,7 @@ int main(int argc, char **argv) {
3335
printf("Content of p2 is: %d\n", *p3);
3436
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
3537
// CHECK: {{#0 0x.* in main .*zero_alloc.cpp:}}[[@LINE-2]]
38+
// DISCOUNT: Uninitialized value was created by a heap allocation
3639
// ORIGINS: Uninitialized value is outside of heap allocation
3740
free(p3);
3841
}

0 commit comments

Comments
 (0)