src/cmd/gc/align.c | 5 +++++ test/fixedbugs/issue9432.go | 15 +++++++++++++++ diff --git a/src/cmd/gc/align.c b/src/cmd/gc/align.c index 6e5d149c750829b675f2262cbb375b43835bcfb5..63ed2e5af66986ac9c7aef18f52cc575ea35e46c 100644 --- a/src/cmd/gc/align.c +++ b/src/cmd/gc/align.c @@ -128,6 +128,11 @@ lineno = lno; return; } + // break infinite recursion if the broken recursive type + // is referenced again + if(t->broke && t->width == 0) + return; + // defer checkwidth calls until after we're done defercalc++; diff --git a/test/fixedbugs/issue9432.go b/test/fixedbugs/issue9432.go new file mode 100644 index 0000000000000000000000000000000000000000..0d0bc960f948e8874f3f0b37f3b376676c8a52f3 --- /dev/null +++ b/test/fixedbugs/issue9432.go @@ -0,0 +1,15 @@ +// errorcheck + +// Copyright 2014 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. + +// gc used to recurse infinitely when dowidth is applied +// to a broken recursive type again. +// See golang.org/issue/9432. +package p + +type foo struct { // GCCGO_ERROR "invalid recursive type" + bar foo + blah foo +} // ERROR "invalid recursive type foo"