diff options
author | Russ Cox <rsc@golang.org> | 2011-04-26 00:57:03 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-04-26 00:57:03 -0400 |
commit | bac8f180352213e7fcbe92cc97c96f625e23d2ab (patch) | |
tree | 2c6e82e458b1c59d098279a80305e0627ed88d10 /test/func7.go | |
parent | f813702f6de54b2cde8df73e5a06bfb5de20b930 (diff) | |
download | go-bac8f180352213e7fcbe92cc97c96f625e23d2ab.tar.gz go-bac8f180352213e7fcbe92cc97c96f625e23d2ab.zip |
gc: fix order of operations for f() < g().
Also, 6g was passing uninitialized
Node &n2 to regalloc, causing non-deterministic
register collisions (but only when both left and
right hand side of comparison had function calls).
Fixes #1728.
R=ken2
CC=golang-dev
https://golang.org/cl/4425070
Diffstat (limited to 'test/func7.go')
-rw-r--r-- | test/func7.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/func7.go b/test/func7.go new file mode 100644 index 0000000000..e38b008cc0 --- /dev/null +++ b/test/func7.go @@ -0,0 +1,29 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2011 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +var calledf = false + +func f() int { + calledf = true + return 1 +} + +func g() int { + if !calledf { + println("BUG: func7 - called g before f") + } + return 0 +} + +func main() { + // 6g, 8g, 5g all used to evaluate g() before f(). + if f() < g() { + panic("wrong answer") + } +} + |