OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [fixedbugs/] [bug320.go] - Blame information for rev 700

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 700 jeremybenn
// $G $D/$F.go && $L $F.$A && ./$A.out
2
 
3
// Copyright 2011 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
package main
8
 
9
func main() {
10
        c := make(chan int, 1)
11
        dummy := make(chan int)
12
        v := 0x12345678
13
        for i := 0; i < 10; i++ {
14
                // 6g had a bug that caused select to pass &t to
15
                // selectrecv before allocating the memory for t,
16
                // which caused non-deterministic crashes.
17
                // This test looks for the bug by checking that the
18
                // value received actually ends up in t.
19
                // If the allocation happens after storing through
20
                // whatever garbage &t holds, the later reference
21
                // to t in the case body will use the new pointer and
22
                // not see the received value.
23
                v += 0x1020304
24
                c <- v
25
                select {
26
                case t := <-c:
27
                        go func() {
28
                                f(t)
29
                        }()
30
                        escape(&t)
31
                        if t != v {
32
                                println(i, v, t)
33
                                panic("wrong values")
34
                        }
35
                case dummy <- 1:
36
                }
37
        }
38
}
39
 
40
func escape(*int) {
41
}
42
 
43
func f(int) {
44
}
45
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.