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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [ken/] [simparray.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
package main
8
 
9
var b[10] float32;
10
 
11
func
12
main() {
13
        var a[10] float32;
14
 
15
        for i:=int16(5); i<10; i=i+1 {
16
                a[i] = float32(i);
17
        }
18
 
19
        s1 := float32(0);
20
        for i:=5; i<10; i=i+1 {
21
                s1 = s1 + a[i];
22
        }
23
 
24
        if s1 != 35 { panic(s1); }
25
 
26
        for i:=int16(5); i<10; i=i+1 {
27
                b[i] = float32(i);
28
        }
29
 
30
        s2 := float32(0);
31
        for i:=5; i<10; i=i+1 {
32
                s2 = s2 + b[i];
33
        }
34
 
35
        if s2 != 35 { panic(s2); }
36
 
37
        b := new([100]int);
38
        for i:=0; i<100; i=i+1 {
39
                b[i] = i;
40
        }
41
 
42
        s3 := 0;
43
        for i:=0; i<100; i=i+1 {
44
                s3 = s3+b[i];
45
        }
46
 
47
        if s3 != 4950 { panic(s3); }
48
}

powered by: WebSVN 2.1.0

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