From e56dc9966504405ecdad49f54edb45859ab3fa91 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Sat, 31 May 2014 09:35:54 -0400 Subject: cmd/gc: fix handling of for post-condition in -race mode Fixes #8102. LGTM=bradfitz, dvyukov R=golang-codereviews, bradfitz, dvyukov CC=golang-codereviews https://golang.org/cl/100870046 --- src/pkg/runtime/race/race_test.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/pkg/runtime') diff --git a/src/pkg/runtime/race/race_test.go b/src/pkg/runtime/race/race_test.go index 88ef89d82a..7e0ee866a6 100644 --- a/src/pkg/runtime/race/race_test.go +++ b/src/pkg/runtime/race/race_test.go @@ -155,3 +155,18 @@ func runTests() ([]byte, error) { cmd.Env = append(cmd.Env, `GORACE="suppress_equal_stacks=0 suppress_equal_addresses=0 exitcode=0"`) return cmd.CombinedOutput() } + +func TestIssue8102(t *testing.T) { + // If this compiles with -race, the test passes. + type S struct { + x interface{} + i int + } + c := make(chan int) + a := [2]*int{} + for ; ; c <- *a[S{}.i] { + if t != nil { + break + } + } +} -- cgit v1.3-5-g9baa