mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
cmd/compile: loop to ensure all autogenerated functions are compiled
I was wrong. There was a need to loop here. Fixes #24761 Change-Id: If13b3ab72febde930bdaebdddd1c05e0d0446020 Reviewed-on: https://go-review.googlesource.com/105615 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
8f6ae33796
commit
2dfb423e6e
4 changed files with 43 additions and 9 deletions
|
|
@ -144,16 +144,17 @@ func dumpLinkerObj(bout *bio.Writer) {
|
||||||
dumpimportstrings()
|
dumpimportstrings()
|
||||||
dumpbasictypes()
|
dumpbasictypes()
|
||||||
|
|
||||||
// The first call to dumpsignats can generate functions,
|
// Calls to dumpsignats can generate functions,
|
||||||
// like method wrappers and hash and equality routines.
|
// like method wrappers and hash and equality routines.
|
||||||
compileFunctions()
|
// Compile any generated functions, process any new resulting types, repeat.
|
||||||
|
// This can't loop forever, because there is no way to generate an infinite
|
||||||
// Process any new signats added during compilation.
|
// number of types in a finite amount of code.
|
||||||
// No need to loop here; signats from compiling the generated
|
// In the typical case, we loop 0 or 1 times.
|
||||||
// functions should not themselves generate new functions.
|
// It was not until issue 24761 that we found any code that required a loop at all.
|
||||||
// If they do, we'll know about it; the sanity check of
|
for len(compilequeue) > 0 {
|
||||||
// len(compilequeue) in gc.Main will fail.
|
compileFunctions()
|
||||||
dumpsignats()
|
dumpsignats()
|
||||||
|
}
|
||||||
|
|
||||||
// Dump extra globals.
|
// Dump extra globals.
|
||||||
tmp := externdcl
|
tmp := externdcl
|
||||||
|
|
|
||||||
15
test/fixedbugs/issue24761.dir/a.go
Normal file
15
test/fixedbugs/issue24761.dir/a.go
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
// Copyright 2018 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
|
||||||
|
|
||||||
|
type T2 struct{}
|
||||||
|
|
||||||
|
func (t *T2) M2(a, b float64) {
|
||||||
|
variadic(a, b)
|
||||||
|
}
|
||||||
|
|
||||||
|
func variadic(points ...float64) {
|
||||||
|
println(points)
|
||||||
|
}
|
||||||
11
test/fixedbugs/issue24761.dir/b.go
Normal file
11
test/fixedbugs/issue24761.dir/b.go
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
// Copyright 2018 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"
|
||||||
|
|
||||||
|
type T1 struct {
|
||||||
|
*a.T2
|
||||||
|
}
|
||||||
7
test/fixedbugs/issue24761.go
Normal file
7
test/fixedbugs/issue24761.go
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
// compiledir -c=4
|
||||||
|
|
||||||
|
// Copyright 2018 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 ignored
|
||||||
Loading…
Add table
Add a link
Reference in a new issue