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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [ken/] [ptrvar.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 2009 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
 
8
package main
9
 
10
type    x2      struct { a,b,c int; d int; };
11
var     g1      x2;
12
var     g2      struct { a,b,c int; d x2; };
13
 
14
func
15
main() {
16
        var x int;
17
        var s1 *x2;
18
        var s2 *struct { a,b,c int; d x2; };
19
 
20
        s1 = &g1;
21
        s2 = &g2;
22
 
23
        s1.a = 1;
24
        s1.b = 2;
25
        s1.c = 3;
26
        s1.d = 5;
27
 
28
        s2.a = 7;
29
        s2.b = 11;
30
        s2.c = 13;
31
        s2.d.a = 17;
32
        s2.d.b = 19;
33
        s2.d.c = 23;
34
        s2.d.d = 20;
35
 
36
        if(s2.d.c != 23) { panic(1); }
37
        if(g2.d.c != 23) { panic(2); }
38
 
39
        x =     s1.a +
40
                s1.b +
41
                s1.c +
42
                s1.d +
43
 
44
                s2.a +
45
                s2.b +
46
                s2.c +
47
                s2.d.a +
48
                s2.d.b +
49
                s2.d.c +
50
                s2.d.d;
51
 
52
        if(x != 121) { panic(x); }
53
}

powered by: WebSVN 2.1.0

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