]> Cypherpunks repositories - gostls13.git/commitdiff
gc: fix compiler crash
authorRuss Cox <rsc@golang.org>
Thu, 17 Dec 2009 23:08:55 +0000 (15:08 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 17 Dec 2009 23:08:55 +0000 (15:08 -0800)
R=ken2
CC=dho
https://golang.org/cl/179097

src/cmd/gc/walk.c
test/fixedbugs/bug235.go [new file with mode: 0644]

index 1d52d05cc4a3b300cb35fc1258b7d29f74c882cd..80b0944d8baf9151fcb205c0c3737ca62763593c 100644 (file)
@@ -231,6 +231,8 @@ walkdef(Node *n)
                t->printed = 0;
                t->method = nil;
                t->nod = N;
+               t->printed = 0;
+               t->deferwidth = 0;
 
                // double-check use of type as map key
                // TODO(rsc): also use of type as receiver?
diff --git a/test/fixedbugs/bug235.go b/test/fixedbugs/bug235.go
new file mode 100644 (file)
index 0000000..8cecd9d
--- /dev/null
@@ -0,0 +1,17 @@
+// $G $D/$F.go
+
+// Copyright 2009 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.
+
+// used to crash the compiler
+
+package main
+
+type T struct {
+       x [4]byte
+}
+
+var p *T
+var v = *p
+