From: Keith Randall Date: Fri, 4 Apr 2014 19:58:19 +0000 (-0700) Subject: cmd/gc: compute size of keys & values before making map bucket X-Git-Tag: go1.3beta1~181 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=375b7bb76786ad61711771c7703f4c71b4489987;p=gostls13.git cmd/gc: compute size of keys & values before making map bucket Fixes #7547 LGTM=iant R=iant, khr CC=golang-codereviews https://golang.org/cl/84470046 --- diff --git a/src/cmd/gc/reflect.c b/src/cmd/gc/reflect.c index 3f4734ef52..75d7d8c1c8 100644 --- a/src/cmd/gc/reflect.c +++ b/src/cmd/gc/reflect.c @@ -125,6 +125,8 @@ mapbucket(Type *t) keytype = t->down; valtype = t->type; + dowidth(keytype); + dowidth(valtype); if(keytype->width > MAXKEYSIZE) keytype = ptrto(keytype); if(valtype->width > MAXVALSIZE) diff --git a/test/fixedbugs/issue7547.go b/test/fixedbugs/issue7547.go new file mode 100644 index 0000000000..f75a33036f --- /dev/null +++ b/test/fixedbugs/issue7547.go @@ -0,0 +1,17 @@ +// compile + +// 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. + +package main + +func f() map[string]interface{} { + var p *map[string]map[string]interface{} + _ = p + return nil +} + +func main() { + f() +}