go/analysis/passes/asmdecl: fix a panic under go1.10

Now that asmdecl is not in the standard repo, we must not assume
that types.SizesFor knows about all architectures and panic if it
does not. This change makes it print a warning and assume 64-bit
norms.

Change-Id: Idacad350b2fc9343adfb32539fec7003b39380ed
Reviewed-on: https://go-review.googlesource.com/c/141679
Reviewed-by: Michael Matloob <matloob@golang.org>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
diff --git a/go/analysis/passes/asmdecl/asmdecl.go b/go/analysis/passes/asmdecl/asmdecl.go
index bafb39e..5a076ee 100644
--- a/go/analysis/passes/asmdecl/asmdecl.go
+++ b/go/analysis/passes/asmdecl/asmdecl.go
@@ -11,6 +11,7 @@
 	"go/build"
 	"go/token"
 	"go/types"
+	"log"
 	"regexp"
 	"strconv"
 	"strings"
@@ -107,7 +108,13 @@
 	for _, arch := range arches {
 		arch.sizes = types.SizesFor("gc", arch.name)
 		if arch.sizes == nil {
-			panic("missing SizesFor for gc/" + arch.name)
+			// TODO(adonovan): fix: now that asmdecl is not in the standard
+			// library we cannot assume types.SizesFor is consistent with arches.
+			// For now, assume 64-bit norms and print a warning.
+			// But this warning should really be deferred until we attempt to use
+			// arch, which is very unlikely.
+			arch.sizes = types.SizesFor("gc", "amd64")
+			log.Printf("unknown architecture %s", arch.name)
 		}
 		arch.intSize = int(arch.sizes.Sizeof(types.Typ[types.Int]))
 		arch.ptrSize = int(arch.sizes.Sizeof(types.Typ[types.UnsafePointer]))