FAQ
Reviewers: golang-dev_googlegroups.com,

Message:
Hello golang-dev@googlegroups.com (cc: golang-dev@googlegroups.com),

I'd like you to review this change to
https://go.googlecode.com/hg/


Description:
cmd/gc: fix internal compiler error with broken structs.

Fixes issue 4359.

Please review this at http://codereview.appspot.com/6834043/

Affected files:
M src/cmd/gc/typecheck.c
A test/fixedbugs/issue4359.go


Index: src/cmd/gc/typecheck.c
===================================================================
--- a/src/cmd/gc/typecheck.c
+++ b/src/cmd/gc/typecheck.c
@@ -443,7 +443,7 @@
ok |= Etype;
n->op = OTYPE;
n->type = tostruct(n->list);
- if(n->type == T)
+ if(n->type == T || n->type->broke)
goto error;
n->list = nil;
break;
Index: test/fixedbugs/issue4359.go
===================================================================
new file mode 100644
--- /dev/null
+++ b/test/fixedbugs/issue4359.go
@@ -0,0 +1,19 @@
+// errorcheck
+
+// Copyright 2012 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.
+
+// Issue 4359: wrong handling of broken struct fields
+// causes "internal compiler error: lookdot badwidth".
+
+package main
+
+type T struct {
+ x T1 // ERROR "undefined"
+}
+
+func f() {
+ var t *T
+ _ = t.x
+}

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedNov 7, '12 at 9:06p
activeNov 7, '12 at 10:09p
posts4
users3
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase