tsan: fix build bugs

1. Fix expression inside of DCHECK_LE.
2. Add a debug build test to buildgo.sh.
3. Fix race binary path in buildgo.sh.
This commit is contained in:
Dmitry Vyukov 2020-03-28 09:07:15 +01:00
parent 06066c4003
commit 65b4695375
2 changed files with 13 additions and 9 deletions

View File

@ -150,15 +150,19 @@ for F in $SRCS; do
done
FLAGS=" -I../rtl -I../.. -I../../sanitizer_common -I../../../include -std=c++11 -Wall -fno-exceptions -fno-rtti -DSANITIZER_GO=1 -DSANITIZER_DEADLOCK_DETECTOR_VERSION=2 $OSCFLAGS $ARCHCFLAGS"
DEBUG_FLAGS="$FLAGS -DSANITIZER_DEBUG=1 -g"
FLAGS="$FLAGS -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer"
if [ "$SUFFIX" = "linux_ppc64le" ]; then
FLAGS="$FLAGS -mcpu=power8 -fno-function-sections"
elif [ "$SUFFIX" = "linux_amd64" ]; then
FLAGS="$FLAGS -msse3"
fi
if [ "$DEBUG" = "" ]; then
FLAGS="$FLAGS -DSANITIZER_DEBUG=0 -O3 -fomit-frame-pointer"
if [ "$SUFFIX" = "linux_ppc64le" ]; then
FLAGS="$FLAGS -mcpu=power8 -fno-function-sections"
elif [ "$SUFFIX" = "linux_amd64" ]; then
FLAGS="$FLAGS -msse3"
fi
# Do a build test with debug flags.
$CC $DIR/gotsan.cpp -c -o $DIR/race_debug_$SUFFIX.syso $DEBUG_FLAGS $CFLAGS
else
FLAGS="$FLAGS -DSANITIZER_DEBUG=1 -g"
FLAGS="$DEBUG_FLAGS"
fi
if [ "$SILENT" != "1" ]; then
@ -169,7 +173,7 @@ $CC $DIR/gotsan.cpp -c -o $DIR/race_$SUFFIX.syso $FLAGS $CFLAGS
$CC $OSCFLAGS $ARCHCFLAGS test.c $DIR/race_$SUFFIX.syso -g -o $DIR/test $OSLDFLAGS $LDFLAGS
# Verify that no glibc specific code is present
if nm race_$SUFFIX.syso | grep -q __libc_; then
if nm $DIR/race_$SUFFIX.syso | grep -q __libc_; then
printf -- '%s seems to link to libc\n' "race_$SUFFIX.syso"
exit 1
fi

View File

@ -187,7 +187,7 @@ void ThreadClock::acquire(ClockCache *c, SyncClock *src) {
void ThreadClock::releaseStoreAcquire(ClockCache *c, SyncClock *sc) {
DCHECK_LE(nclk_, kMaxTid);
DCHECK_LE(dst->size_, kMaxTid);
DCHECK_LE(sc->size_, kMaxTid);
if (sc->size_ == 0) {
// ReleaseStore will correctly set release_store_tid_,