From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- gcc/testsuite/go.test/test/ken/chan1.go | 53 +++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gcc/testsuite/go.test/test/ken/chan1.go (limited to 'gcc/testsuite/go.test/test/ken/chan1.go') diff --git a/gcc/testsuite/go.test/test/ken/chan1.go b/gcc/testsuite/go.test/test/ken/chan1.go new file mode 100644 index 000000000..e5fc033f3 --- /dev/null +++ b/gcc/testsuite/go.test/test/ken/chan1.go @@ -0,0 +1,53 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2009 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "runtime" + +const N = 1000 // sent messages +const M = 10 // receiving goroutines +const W = 2 // channel buffering +var h [N]int // marking of send/recv + +func r(c chan int, m int) { + for { + select { + case r := <-c: + if h[r] != 1 { + println("r", + "m=", m, + "r=", r, + "h=", h[r]) + panic("fail") + } + h[r] = 2 + } + } +} + +func s(c chan int) { + for n := 0; n < N; n++ { + r := n + if h[r] != 0 { + println("s") + panic("fail") + } + h[r] = 1 + c <- r + } +} + +func main() { + c := make(chan int, W) + for m := 0; m < M; m++ { + go r(c, m) + runtime.Gosched() + } + runtime.Gosched() + runtime.Gosched() + s(c) +} -- cgit v1.2.3