mirror of
https://github.com/golang/go
synced 2024-09-04 23:44:16 +00:00
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:
parent
bb431245cc
commit
8d47b08255
|
@ -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
|
||||
|
|
7
test/fixedbugs/issue8060.dir/a.go
Normal file
7
test/fixedbugs/issue8060.dir/a.go
Normal 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{}
|
13
test/fixedbugs/issue8060.dir/b.go
Normal file
13
test/fixedbugs/issue8060.dir/b.go
Normal 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{}
|
||||
}
|
9
test/fixedbugs/issue8060.go
Normal file
9
test/fixedbugs/issue8060.go
Normal 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
|
Loading…
Reference in a new issue