1
0
mirror of https://github.com/golang/go synced 2024-11-23 00:10:07 -07:00
go/test/abi/convT64_criteria.go
Than McIntosh ca8540affd cmd/compile: fix buglet in walk convert phase relating to convT64
The function runtime.convT64 accepts a single uint64 argument, but the
compiler's rules in the walk phase for determining whether is it ok to
pass a value of type T to a call to runtime.convT64 were slightly off.
In particular the test was allowing a type T with size less than eight
bytes but with more than one internal element (e.g. a struct). This
patch tightens up the rules somewhat to prevent this from happening.

Updates #40724.

Change-Id: I3b909267534db59429b0aa73a3d73333e1bd6432
Reviewed-on: https://go-review.googlesource.com/c/go/+/308069
Trust: Than McIntosh <thanm@google.com>
Run-TryBot: Than McIntosh <thanm@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
2021-04-08 17:44:21 +00:00

26 lines
387 B
Go

// run
// 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.
package main
import (
"fmt"
)
type MyStruct struct {
F0 [0]float64
F1 byte
F2 int16
_ struct {
F0 uint32
}
}
func main() {
p0 := MyStruct{F0: [0]float64{}, F1: byte(27), F2: int16(9887)}
fmt.Println(p0)
}