1// 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}
31