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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [fixedbugs/] [bug262.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 2010 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
import (
10
        "os"
11
        "strconv"
12
)
13
 
14
var trace string
15
 
16
func f() string {
17
        trace += "f"
18
        return "abc"
19
}
20
 
21
func g() *error {
22
        trace += "g"
23
        var x error
24
        return &x
25
}
26
 
27
func h() string {
28
        trace += "h"
29
        return "123"
30
}
31
 
32
func i() *int {
33
        trace += "i"
34
        var i int
35
        return &i
36
}
37
 
38
func main() {
39
        m := make(map[string]int)
40
        m[f()], *g() = strconv.Atoi(h())
41
        if m["abc"] != 123 || trace != "fgh" {
42
                println("BUG", m["abc"], trace)
43
                panic("fail")
44
        }
45
        mm := make(map[string]error)
46
        trace = ""
47
        mm["abc"] = os.EINVAL
48
        *i(), mm[f()] = strconv.Atoi(h())
49
        if mm["abc"] != nil || trace != "ifh" {
50
                println("BUG1", mm["abc"], trace)
51
                panic("fail")
52
        }
53
}

powered by: WebSVN 2.1.0

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