summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2010-05-03 17:51:48 -0700
committerRuss Cox <rsc@golang.org>2010-05-03 17:51:48 -0700
commit0e9d0a01af68b63a25ce7a2d571e934d55bf7807 (patch)
treea704f2448939395abf30bc38c7f1f6738e35cc0d
parent845d5d9942d1b711edbc15a105c4621b1122fd38 (diff)
downloadgo-0e9d0a01af68b63a25ce7a2d571e934d55bf7807.tar.gz
gc: bug264
Fixes issue 692. R=ken2 CC=golang-dev http://codereview.appspot.com/1092041
-rw-r--r--src/cmd/gc/sinit.c4
-rw-r--r--test/fixedbugs/bug264.go (renamed from test/bugs/bug264.go)5
-rw-r--r--test/golden.out11
3 files changed, 3 insertions, 17 deletions
diff --git a/src/cmd/gc/sinit.c b/src/cmd/gc/sinit.c
index 6f0772b63..20822542a 100644
--- a/src/cmd/gc/sinit.c
+++ b/src/cmd/gc/sinit.c
@@ -31,8 +31,10 @@ init1(Node *n, NodeList **out)
case PFUNC:
break;
default:
- if(isblank(n))
+ if(isblank(n) && n->defn != N && !n->defn->initorder) {
+ n->defn->initorder = 1;
*out = list(*out, n->defn);
+ }
return;
}
diff --git a/test/bugs/bug264.go b/test/fixedbugs/bug264.go
index e0b288d94..6d86c6fe5 100644
--- a/test/bugs/bug264.go
+++ b/test/fixedbugs/bug264.go
@@ -8,27 +8,22 @@
package main
-import "fmt"
-
var fooCount = 0
var barCount = 0
var balCount = 0
func foo() (int, int) {
fooCount++
- fmt.Println("foo")
return 0, 0
}
func bar() (int, int) {
barCount++
- fmt.Println("bar")
return 0, 0
}
func bal() (int, int) {
balCount++
- fmt.Println("bal")
return 0, 0
}
diff --git a/test/golden.out b/test/golden.out
index 59aec777b..49bca4b87 100644
--- a/test/golden.out
+++ b/test/golden.out
@@ -177,14 +177,3 @@ panic PC=xxx
=========== bugs/bug260.go
FAIL
BUG: bug260 failed
-
-=========== bugs/bug264.go
-foo
-bar
-bar
-bal
-bal
-panic: barCount != 1
-
-panic PC=xxx
-BUG