cmd/gc: generate type alg after calling dowidth.

Previously it might happen before calling dowidth and
result in a compiler crash.

Fixes #8060.

LGTM=dvyukov, rsc
R=golang-codereviews, dvyukov, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/110980044
This commit is contained in:
Rémy Oudompheng 2014-09-15 18:24:16 +02:00
parent bb431245cc
commit 8d47b08255
4 changed files with 30 additions and 1 deletions

View file

@ -727,12 +727,12 @@ dcommontype(Sym *s, int ot, Type *t)
sizeofAlg = 2*widthptr;
if(algarray == nil)
algarray = pkglookup("algarray", runtimepkg);
dowidth(t);
alg = algtype(t);
algsym = S;
if(alg < 0)
algsym = dalgsym(t);
dowidth(t);
if(t->sym != nil && !isptr[t->etype])
sptr = dtypesym(ptrto(t));
else

View file

@ -0,0 +1,7 @@
// 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 a
var A = []*[2][1]float64{}

View file

@ -0,0 +1,13 @@
// 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 b
import "a"
var X = a.A
func b() {
_ = [3][1]float64{}
}

View file

@ -0,0 +1,9 @@
// compiledir
// 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.
// Issue 8060: internal compiler error.
package ignored