From: Russ Cox Date: Thu, 15 Jul 2010 22:17:42 +0000 (-0700) Subject: gc: bug291 X-Git-Tag: weekly.2010-07-29~98 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=08a263a991c2e5b38eebe6955ecc96372822661a;p=gostls13.git gc: bug291 Fixes #915. R=ken2 CC=golang-dev https://golang.org/cl/1856042 --- diff --git a/src/cmd/gc/sinit.c b/src/cmd/gc/sinit.c index 5ac14a5375..e984e99c3e 100644 --- a/src/cmd/gc/sinit.c +++ b/src/cmd/gc/sinit.c @@ -92,15 +92,9 @@ init1(Node *n, NodeList **out) break; case OAS2FUNC: - if(n->defn->initorder) - break; - n->defn->initorder = 1; - for(l=n->defn->rlist; l; l=l->next) - init1(l->n, out); - *out = list(*out, n->defn); - break; - case OAS2MAPR: + case OAS2DOTTYPE: + case OAS2RECV: if(n->defn->initorder) break; n->defn->initorder = 1; diff --git a/test/fixedbugs/bug291.go b/test/fixedbugs/bug291.go new file mode 100644 index 0000000000..09334c9211 --- /dev/null +++ b/test/fixedbugs/bug291.go @@ -0,0 +1,23 @@ +// $G $D/$F.go && $L $F.$A && ./$A.out + +// Copyright 2010 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. + +// http://code.google.com/p/go/issues/detail?id=915 + +package main + +type T struct { + x int +} + +var t = &T{42} +var i interface{} = t +var tt, ok = i.(*T) + +func main() { + if tt == nil || tt.x != 42 { + println("BUG") + } +} diff --git a/test/golden.out b/test/golden.out index 1bed6599a8..49bca4b874 100644 --- a/test/golden.out +++ b/test/golden.out @@ -177,6 +177,3 @@ panic PC=xxx =========== bugs/bug260.go FAIL BUG: bug260 failed - -=========== bugs/bug274.go -BUG: errchk: command succeeded unexpectedly