]> Cypherpunks repositories - gostls13.git/commitdiff
gc: bug291
authorRuss Cox <rsc@golang.org>
Thu, 15 Jul 2010 22:17:42 +0000 (15:17 -0700)
committerRuss Cox <rsc@golang.org>
Thu, 15 Jul 2010 22:17:42 +0000 (15:17 -0700)
Fixes #915.

R=ken2
CC=golang-dev
https://golang.org/cl/1856042

src/cmd/gc/sinit.c
test/fixedbugs/bug291.go [new file with mode: 0644]
test/golden.out

index 5ac14a5375a6232404d0b8d1275e7e96c174ac3f..e984e99c3ea0afe009708e1cda8633fc22275ec8 100644 (file)
@@ -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 (file)
index 0000000..09334c9
--- /dev/null
@@ -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")
+       }
+}
index 1bed6599a8d27bb8726e78d03c8984bef1bfd9da..49bca4b874b17eba73c447c88bc23ba74813597b 100644 (file)
@@ -177,6 +177,3 @@ panic PC=xxx
 =========== bugs/bug260.go
 FAIL
 BUG: bug260 failed
-
-=========== bugs/bug274.go
-BUG: errchk: command succeeded unexpectedly