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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [go.test/] [test/] [fixedbugs/] [bug159.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 || echo BUG: bug159
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
import "os"
10
 
11
func main() {
12
        ok := true;
13
        var a, b, c, x, y, z int;
14
        f := func() int { b--; return -b };
15
 
16
        // this fails on 6g: apparently it rewrites
17
        // the list into
18
        //      z = f();
19
        //      y = f();
20
        //      x = f();
21
        // so that the values come out backward.
22
        x, y, z = f(), f(), f();
23
        if x != 1 || y != 2 || z != 3 {
24
                println("xyz: expected 1 2 3 got", x, y, z);
25
                ok = false;
26
        }
27
 
28
        // this fails on 6g too.  one of the function calls
29
        // happens after assigning to b.
30
        a, b, c = f(), f(), f();
31
        if a != 4 || b != 5 || c != 6 {
32
                println("abc: expected 4 5 6 got", a, b, c);
33
                ok = false;
34
        }
35
 
36
        if !ok {
37
                os.Exit(1);
38
        }
39
}

powered by: WebSVN 2.1.0

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