summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/tsan
diff options
context:
space:
mode:
authorKostya Serebryany <kcc@google.com>2013-03-28 08:41:49 +0000
committerKostya Serebryany <kcc@google.com>2013-03-28 08:41:49 +0000
commitac83282665651d6db6d5e3b9c6b084e1b19a445f (patch)
treed0e09b9a2dbf23ac7b684a0d4fd794a66c861407 /compiler-rt/lib/tsan
parent279ca4d6084a8c8703f25fac30336fdfce207647 (diff)
downloadbcm5719-llvm-ac83282665651d6db6d5e3b9c6b084e1b19a445f.tar.gz
bcm5719-llvm-ac83282665651d6db6d5e3b9c6b084e1b19a445f.zip
[tsan] don't use -fno-builtin for tests; add a test for a false negative bug (inlined memcpy is not instrumented)
llvm-svn: 178228
Diffstat (limited to 'compiler-rt/lib/tsan')
-rw-r--r--compiler-rt/lib/tsan/lit_tests/inlined_memcpy_race.cc27
-rw-r--r--compiler-rt/lib/tsan/lit_tests/lit.cfg1
-rwxr-xr-xcompiler-rt/lib/tsan/lit_tests/test_output.sh2
3 files changed, 28 insertions, 2 deletions
diff --git a/compiler-rt/lib/tsan/lit_tests/inlined_memcpy_race.cc b/compiler-rt/lib/tsan/lit_tests/inlined_memcpy_race.cc
new file mode 100644
index 00000000000..33dbf189616
--- /dev/null
+++ b/compiler-rt/lib/tsan/lit_tests/inlined_memcpy_race.cc
@@ -0,0 +1,27 @@
+// RUN: %clangxx_tsan -O1 %s -o %t && %t 2>&1 | FileCheck %s
+// Currently, we don't report a race here:
+// http://code.google.com/p/thread-sanitizer/issues/detail?id=16
+#include <pthread.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
+int x[4], y[4];
+
+void *Thread1(void *unused) {
+ memcpy(x, y, 16);
+ return NULL;
+}
+
+int main() {
+ pthread_t t[2];
+ pthread_create(&t[0], NULL, Thread1, NULL);
+ pthread_create(&t[1], NULL, Thread1, NULL);
+ pthread_join(t[0], NULL);
+ pthread_join(t[1], NULL);
+ printf("PASS\n");
+ return 0;
+}
+
+// CHECK-NOT: ThreadSanitizer
diff --git a/compiler-rt/lib/tsan/lit_tests/lit.cfg b/compiler-rt/lib/tsan/lit_tests/lit.cfg
index 7e2db7b8fd0..e2d2bae45ca 100644
--- a/compiler-rt/lib/tsan/lit_tests/lit.cfg
+++ b/compiler-rt/lib/tsan/lit_tests/lit.cfg
@@ -70,7 +70,6 @@ config.environment['TSAN_OPTIONS'] = tsan_options
# FIXME: Review the set of required flags and check if it can be reduced.
clang_tsan_cflags = ("-fsanitize=thread "
+ "-fPIE "
- + "-fno-builtin "
+ "-g "
+ "-Wall "
+ "-pie "
diff --git a/compiler-rt/lib/tsan/lit_tests/test_output.sh b/compiler-rt/lib/tsan/lit_tests/test_output.sh
index f4f8a5c8e0d..cffc026ee2a 100755
--- a/compiler-rt/lib/tsan/lit_tests/test_output.sh
+++ b/compiler-rt/lib/tsan/lit_tests/test_output.sh
@@ -12,7 +12,7 @@ BLACKLIST=$ROOTDIR/lit_tests/Helpers/blacklist.txt
: ${FILECHECK:=FileCheck}
# TODO: add testing for all of -O0...-O3
-CFLAGS="-fsanitize=thread -fsanitize-blacklist=$BLACKLIST -fPIE -O1 -g -fno-builtin -Wall"
+CFLAGS="-fsanitize=thread -fsanitize-blacklist=$BLACKLIST -fPIE -O1 -g -Wall"
LDFLAGS="-pie -lpthread -ldl $ROOTDIR/rtl/libtsan.a"
test_file() {
OpenPOWER on IntegriCloud