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

llvm-svn: 178228
This commit is contained in:
Kostya Serebryany 2013-03-28 08:41:49 +00:00
parent 279ca4d608
commit ac83282665
3 changed files with 28 additions and 2 deletions

View File

@ -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

View File

@ -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 "

View File

@ -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() {