summaryrefslogtreecommitdiff
path: root/lib
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
commit83b47072ff373766b8f424e31c278cfa31ab46a3 (patch)
treee48bf7558a33dc52da3bf130db4136eacdde9cdf /lib
parentc446611d505593bb8e79ea98df87479e24cce68b (diff)
downloadcompiler-rt-83b47072ff373766b8f424e31c278cfa31ab46a3.tar.gz
compiler-rt-83b47072ff373766b8f424e31c278cfa31ab46a3.tar.bz2
compiler-rt-83b47072ff373766b8f424e31c278cfa31ab46a3.tar.xz
[tsan] don't use -fno-builtin for tests; add a test for a false negative bug (inlined memcpy is not instrumented)
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@178228 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/tsan/lit_tests/inlined_memcpy_race.cc27
-rw-r--r--lib/tsan/lit_tests/lit.cfg1
-rwxr-xr-xlib/tsan/lit_tests/test_output.sh2
3 files changed, 28 insertions, 2 deletions
diff --git a/lib/tsan/lit_tests/inlined_memcpy_race.cc b/lib/tsan/lit_tests/inlined_memcpy_race.cc
new file mode 100644
index 00000000..33dbf189
--- /dev/null
+++ b/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/lib/tsan/lit_tests/lit.cfg b/lib/tsan/lit_tests/lit.cfg
index 7e2db7b8..e2d2bae4 100644
--- a/lib/tsan/lit_tests/lit.cfg
+++ b/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/lib/tsan/lit_tests/test_output.sh b/lib/tsan/lit_tests/test_output.sh
index f4f8a5c8..cffc026e 100755
--- a/lib/tsan/lit_tests/test_output.sh
+++ b/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() {