Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reflect: func created w/MakeFunc returns mangled value when used as a parameter to another func via Call on ARM #53395

Closed
thempatel opened this issue Jun 15, 2022 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@thempatel
Copy link

thempatel commented Jun 15, 2022

What version of Go are you using (go version)?

$ go version
go version go1.18 darwin/arm64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

OS X 12.4 (Monterey) Apple M1 Pro (ARM)

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/milan/Library/Caches/go-build"
GOENV="/Users/milan/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/milan/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/milan/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/Users/milan/src/fsdev/tools/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/Users/milan/src/fsdev/tools/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.18"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/milan/src/go-reflect-issue/go.mod"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/wm/x3qn31vj0hgg60d8s9m3brlh0000gq/T/go-build2169734258=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

https://go.dev/play/p/Vcob_D0J733

What did you expect to see?

Both tests should pass on ARM.

What did you see instead?

Second test fails, i.e the one that tests calling a function with reflect.

Prose

As the title indicates, on ARM, it appears that MakeFunc results in a func that returns a mangled value when used as a parameter to another function that was invoked using Call. This problem does not occur on amd64 architectures, it is currently, at the very least, a problem on ARM architectures.

@seankhliao seankhliao added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jun 15, 2022
@seankhliao
Copy link
Member

cc @golang/runtime

@cherrymui
Copy link
Member

This fails with Go 1.18 but passes on ARM64 on tip. Looks the same as #52788 .

@thempatel
Copy link
Author

@cherrymui these look related! Great. Can you comment on when the fixes will be released? Is it a cherry-pick candidate or will we need to wait for go1.19?

@cherrymui
Copy link
Member

I opened backport issues for #52788. It may be included in the next Go 1.18 and 1.17 releases in early July.

I think we can close this as a dup. Thanks.

@thempatel
Copy link
Author

thank you!

@golang golang locked and limited conversation to collaborators Jun 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants