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
This commit is contained in:
Keith Randall 2014-04-04 12:58:19 -07:00
parent 1daa2520bf
commit 375b7bb767
2 changed files with 19 additions and 0 deletions

View file

@ -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)

View file

@ -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()
}