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 000000000000..33dbf189616a --- /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 +#include +#include +#include +#include + +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 7e2db7b8fd0b..e2d2bae45cae 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 f4f8a5c8e0db..cffc026ee2a8 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() {