]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fix buglet in walk convert phase relating to convT64
authorThan McIntosh <thanm@google.com>
Wed, 7 Apr 2021 16:56:43 +0000 (12:56 -0400)
committerThan McIntosh <thanm@google.com>
Thu, 8 Apr 2021 17:44:21 +0000 (17:44 +0000)
commitca8540affd43580772589263951fd01e04f6ad07
treea984fd6a0cb92c3d79030f9fc38c5d7387e32d10
parentd474b6c824249dcdd6cddfb6bf43366e092df022
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>
src/cmd/compile/internal/walk/convert.go
test/abi/convT64_criteria.go [new file with mode: 0644]
test/abi/convT64_criteria.out [new file with mode: 0644]