]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: prevent infinite recursion printing types in Fatalf
authorJosh Bleecher Snyder <josharian@gmail.com>
Fri, 28 Apr 2017 14:23:26 +0000 (07:23 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Fri, 28 Apr 2017 16:08:01 +0000 (16:08 +0000)
Updates #20162

Change-Id: Ie289bae0d0be8430e492ac73fd6e6bf36991d4a1
Reviewed-on: https://go-review.googlesource.com/42130
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/cmd/compile/internal/gc/align.go

index a270adf653d73524a696303a5fd8fd7054ca4327..6f7e67ca93b5a8d99f6e2f563377aa5d006f820e 100644 (file)
@@ -183,6 +183,11 @@ func dowidth(t *types.Type) {
        }
 
        if sizeCalculationDisabled {
+               if t.Broke() {
+                       // break infinite recursion from Fatal call below
+                       return
+               }
+               t.SetBroke(true)
                Fatalf("width not calculated: %v", t)
        }