[compiler-rt] f9a135b - [dfsan] Test dfsan_flush with origins

Jianzhou Zhao via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 24 17:13:28 PDT 2021


Author: Jianzhou Zhao
Date: 2021-03-25T00:12:53Z
New Revision: f9a135b65273e01a0f0661c62ce91b1a3d3210aa

URL: https://github.com/llvm/llvm-project/commit/f9a135b65273e01a0f0661c62ce91b1a3d3210aa
DIFF: https://github.com/llvm/llvm-project/commit/f9a135b65273e01a0f0661c62ce91b1a3d3210aa.diff

LOG:  [dfsan] Test dfsan_flush with origins

This is a part of https://reviews.llvm.org/D95835.

Reviewed By: morehouse

Differential Revision: https://reviews.llvm.org/D99295

Added: 
    

Modified: 
    compiler-rt/test/dfsan/flush.c

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/dfsan/flush.c b/compiler-rt/test/dfsan/flush.c
index a6d5fe696258..88220a32fcb5 100644
--- a/compiler-rt/test/dfsan/flush.c
+++ b/compiler-rt/test/dfsan/flush.c
@@ -1,5 +1,6 @@
 // Tests dfsan_flush().
 // RUN: %clang_dfsan %s -o %t && %run %t
+// RUN: %clang_dfsan -DORIGIN_TRACKING -mllvm -dfsan-track-origins=1 -mllvm -dfsan-fast-16-labels=true %s -o %t && %run %t
 #include <sanitizer/dfsan_interface.h>
 #include <assert.h>
 #include <stdlib.h>
@@ -17,12 +18,20 @@ int main() {
   assert(dfsan_get_label(global) == 10);
   assert(dfsan_get_label(local) == 20);
   assert(dfsan_get_label(*heap) == 30);
+#ifdef ORIGIN_TRACKING
+  assert(dfsan_get_origin(global));
+  assert(dfsan_get_origin(local));
+  assert(dfsan_get_origin(*heap));
+#endif
 
   dfsan_flush();
 
   assert(dfsan_get_label(global) == 0);
   assert(dfsan_get_label(local) == 0);
   assert(dfsan_get_label(*heap) == 0);
+  assert(dfsan_get_origin(global) == 0);
+  assert(dfsan_get_origin(local) == 0);
+  assert(dfsan_get_origin(*heap) == 0);
 
   free(heap);
 }


        


More information about the llvm-commits mailing list