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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [escape3.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
// Test run-time behavior of escape analysis-related optimizations.
8
 
9
package main
10
 
11
func main() {
12
        test1()
13
}
14
 
15
func test1() {
16
        check1(0)
17
        check1(1)
18
        check1(2)
19
}
20
 
21
type T1 struct {
22
        X, Y, Z int
23
}
24
 
25
func f() int {
26
        return 1
27
}
28
 
29
func check1(pass int) T1 {
30
        v := []T1{{X: f(), Z: f()}}
31
        if v[0].Y != 0 {
32
                panic("nonzero init")
33
        }
34
        v[0].Y = pass
35
        return v[0]
36
}

powered by: WebSVN 2.1.0

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