[compiler-rt] r178228 - [tsan] don't use -fno-builtin for tests; add a test for a false negative bug (inlined memcpy is not instrumented)

Kostya Serebryany kcc at google.com
Thu Mar 28 01:41:49 PDT 2013


Author: kcc
Date: Thu Mar 28 03:41:49 2013
New Revision: 178228

URL: http://llvm.org/viewvc/llvm-project?rev=178228&view=rev
Log:
[tsan] don't use -fno-builtin for tests; add a test for a false negative bug (inlined memcpy is not instrumented)

Added:
    compiler-rt/trunk/lib/tsan/lit_tests/inlined_memcpy_race.cc
Modified:
    compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg
    compiler-rt/trunk/lib/tsan/lit_tests/test_output.sh

Added: compiler-rt/trunk/lib/tsan/lit_tests/inlined_memcpy_race.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/inlined_memcpy_race.cc?rev=178228&view=auto
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/inlined_memcpy_race.cc (added)
+++ compiler-rt/trunk/lib/tsan/lit_tests/inlined_memcpy_race.cc Thu Mar 28 03:41:49 2013
@@ -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

Modified: compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg?rev=178228&r1=178227&r2=178228&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/lit.cfg Thu Mar 28 03:41:49 2013
@@ -70,7 +70,6 @@ config.environment['TSAN_OPTIONS'] = tsa
 # 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 "

Modified: compiler-rt/trunk/lib/tsan/lit_tests/test_output.sh
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/tsan/lit_tests/test_output.sh?rev=178228&r1=178227&r2=178228&view=diff
==============================================================================
--- compiler-rt/trunk/lib/tsan/lit_tests/test_output.sh (original)
+++ compiler-rt/trunk/lib/tsan/lit_tests/test_output.sh Thu Mar 28 03:41:49 2013
@@ -12,7 +12,7 @@ BLACKLIST=$ROOTDIR/lit_tests/Helpers/bla
 : ${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() {





More information about the llvm-commits mailing list