Commit 475e7d03 authored by Rémy Oudompheng's avatar Rémy Oudompheng

cmd/gc: fix handling of append with -race.

Also re-enable race tests in run.bash.

Fixes #7334.

LGTM=rsc
R=rsc, dvyukov, iant, bradfitz, dave
CC=golang-codereviews
https://golang.org/cl/65740043
parent 96678f9d
...@@ -2707,9 +2707,10 @@ appendslice(Node *n, NodeList **init) ...@@ -2707,9 +2707,10 @@ appendslice(Node *n, NodeList **init)
fn = syslook("copy", 1); fn = syslook("copy", 1);
argtype(fn, l1->type); argtype(fn, l1->type);
argtype(fn, l2->type); argtype(fn, l2->type);
l = list(l, mkcall1(fn, types[TINT], init, nt = mkcall1(fn, types[TINT], &l,
nptr1, nptr2, nptr1, nptr2,
nodintconst(s->type->type->width))); nodintconst(s->type->type->width));
l = list(l, nt);
} else { } else {
// memmove(&s[len(l1)], &l2[0], len(l2)*sizeof(T)) // memmove(&s[len(l1)], &l2[0], len(l2)*sizeof(T))
nptr1 = nod(OINDEX, s, nod(OLEN, l1, N)); nptr1 = nod(OINDEX, s, nod(OLEN, l1, N));
...@@ -2724,7 +2725,8 @@ appendslice(Node *n, NodeList **init) ...@@ -2724,7 +2725,8 @@ appendslice(Node *n, NodeList **init)
nwid = cheapexpr(conv(nod(OLEN, l2, N), types[TUINTPTR]), &l); nwid = cheapexpr(conv(nod(OLEN, l2, N), types[TUINTPTR]), &l);
nwid = nod(OMUL, nwid, nodintconst(s->type->type->width)); nwid = nod(OMUL, nwid, nodintconst(s->type->type->width));
l = list(l, mkcall1(fn, T, init, nptr1, nptr2, nwid)); nt = mkcall1(fn, T, &l, nptr1, nptr2, nwid);
l = list(l, nt);
} }
// s = s[:len(l1)+len(l2)] // s = s[:len(l1)+len(l2)]
......
...@@ -57,10 +57,8 @@ go test sync -short -timeout=$(expr 120 \* $timeout_scale)s -cpu=10 ...@@ -57,10 +57,8 @@ go test sync -short -timeout=$(expr 120 \* $timeout_scale)s -cpu=10
# Race detector only supported on Linux and OS X, # Race detector only supported on Linux and OS X,
# and only on amd64, and only when cgo is enabled. # and only on amd64, and only when cgo is enabled.
# Disabled due to golang.org/issue/7334; remove XXX below
# and in run.bat to reenable.
case "$GOHOSTOS-$GOOS-$GOARCH-$CGO_ENABLED" in case "$GOHOSTOS-$GOOS-$GOARCH-$CGO_ENABLED" in
XXXlinux-linux-amd64-1 | XXXdarwin-darwin-amd64-1) linux-linux-amd64-1 | darwin-darwin-amd64-1)
echo echo
echo '# Testing race detector.' echo '# Testing race detector.'
go test -race -i runtime/race flag go test -race -i runtime/race flag
...@@ -175,7 +173,7 @@ rm -f goplay ...@@ -175,7 +173,7 @@ rm -f goplay
[ "$GOARCH" == arm ] || [ "$GOARCH" == arm ] ||
(xcd ../test/bench/shootout (xcd ../test/bench/shootout
./timing.sh -test || exit 1 time ./timing.sh -test || exit 1
) || exit $? ) || exit $?
[ "$GOOS" == openbsd ] || # golang.org/issue/5057 [ "$GOOS" == openbsd ] || # golang.org/issue/5057
......
...@@ -54,9 +54,7 @@ echo. ...@@ -54,9 +54,7 @@ echo.
:: Race detector only supported on Linux and OS X, :: Race detector only supported on Linux and OS X,
:: and only on amd64, and only when cgo is enabled. :: and only on amd64, and only when cgo is enabled.
:: Disabled due to golang.org/issue/7334; remove XXX below if not "%GOHOSTOS%-%GOOS%-%GOARCH%-%CGO_ENABLED%" == "windows-windows-amd64-1" goto norace
:: and in run.bash to reenable.
if not "%GOHOSTOS%-%GOOS%-%GOARCH%-%CGO_ENABLED%" == "XXXwindows-windows-amd64-1" goto norace
echo # Testing race detector. echo # Testing race detector.
go test -race -i runtime/race flag go test -race -i runtime/race flag
if errorlevel 1 goto fail if errorlevel 1 goto fail
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment