[compiler-rt] 2df6efe - [DFSan] Re-enable event_callbacks test.
Matt Morehouse via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 09:15:31 PDT 2020
Author: Matt Morehouse
Date: 2020-09-11T09:15:05-07:00
New Revision: 2df6efedef5c7647f966ba238a2901eb4b98204d
URL: https://github.com/llvm/llvm-project/commit/2df6efedef5c7647f966ba238a2901eb4b98204d
DIFF: https://github.com/llvm/llvm-project/commit/2df6efedef5c7647f966ba238a2901eb4b98204d.diff
LOG: [DFSan] Re-enable event_callbacks test.
Mark the dest pointers for memcpy and memmove as volatile, to avoid dead
store elimination. Fixes https://bugs.llvm.org/show_bug.cgi?id=47488.
Added:
Modified:
compiler-rt/test/dfsan/event_callbacks.c
Removed:
################################################################################
diff --git a/compiler-rt/test/dfsan/event_callbacks.c b/compiler-rt/test/dfsan/event_callbacks.c
index 6f9fd289c226..b154c9679d45 100644
--- a/compiler-rt/test/dfsan/event_callbacks.c
+++ b/compiler-rt/test/dfsan/event_callbacks.c
@@ -2,10 +2,6 @@
// RUN: %clang_dfsan -O2 -mllvm -dfsan-event-callbacks %s %t-callbacks.o -o %t
// RUN: %run %t FooBarBaz 2>&1 | FileCheck %s
-// See PR47488, parts of this test get optimized out by a more aggressive
-// dead store eliminator.
-// XFAIL: *
-
// Tests that callbacks are inserted for store events when
// -dfsan-event-callbacks is specified.
@@ -118,14 +114,16 @@ int main(int Argc, char *Argv[]) {
LabelArgv = dfsan_create_label("Argv", 0);
dfsan_set_label(LabelArgv, Argv[1], LenArgv);
- char SinkBuf[64];
- assert(LenArgv < sizeof(SinkBuf) - 1);
+ char Buf[64];
+ assert(LenArgv < sizeof(Buf) - 1);
// CHECK: Label 4 copied to memory
- memcpy(SinkBuf, Argv[1], LenArgv);
+ void *volatile SinkPtr = Buf;
+ memcpy(SinkPtr, Argv[1], LenArgv);
// CHECK: Label 4 copied to memory
- memmove(&SinkBuf[1], SinkBuf, LenArgv);
+ SinkPtr = &Buf[1];
+ memmove(SinkPtr, Buf, LenArgv);
return 0;
}
More information about the llvm-commits
mailing list