blob: 30d7a820acc20ab507df09a99d6be87fa20cc17a [file] [log] [blame]
Matthew Dempsky537ddc92014-12-30 12:31:17 -08001// run
2
3// Copyright 2014 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// Issue 8620. Used to fail with -race.
8
9package main
10
11func min(a, b int) int {
12 if a < b {
13 return a
14 }
15 return b
16}
17
18func test(s1, s2 []struct{}) {
19 n := min(len(s1), len(s2))
20 if copy(s1, s2) != n {
21 panic("bad copy result")
22 }
23}
24
25func main() {
26 var b [100]struct{}
27 test(b[:], b[:])
28 test(b[1:], b[:])
29 test(b[:], b[2:])
30}