1
0
mirror of https://github.com/golang/go synced 2024-11-23 04:40:09 -07:00

cmd/compile: emit definition of 'any' when compiling runtime

Include the predefined type 'any' in the list of other important
predefined types that are emitted when compiling the runtime package
(uintptr, string, etc).

Fixes #49619.

Change-Id: I4a851ba2f302fbc3a425e65daa325c6bf83659da
Reviewed-on: https://go-review.googlesource.com/c/go/+/364377
Trust: Than McIntosh <thanm@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
Than McIntosh 2021-11-16 18:44:08 -05:00
parent a2b8231b91
commit 3d7cb23e3d
2 changed files with 20 additions and 0 deletions

View File

@ -1384,6 +1384,7 @@ func WriteBasicTypes() {
}
writeType(types.NewPtr(types.Types[types.TSTRING]))
writeType(types.NewPtr(types.Types[types.TUNSAFEPTR]))
writeType(types.AnyType)
// emit type structs for error and func(error) string.
// The latter is the type of an auto-generated wrapper.

View File

@ -0,0 +1,19 @@
// build
// Copyright 2021 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.
// This testcase caused a linker crash in DWARF generation.
package main
//go:noinline
func f() any {
var a []any
return a[0]
}
func main() {
f()
}