-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
cmd/compile: ICE when calling ABI0 function via func value #47317
Comments
What's weird about this bug is that when I make a cursory look through the call-related code in ssagen and the back end, I don't actually see any places where we take a types.Field corresponding to a function parameter and look at its Offset field (instead the code is looking at the corresponding ABIParamAssignment object fo r the parameter. Do we really need to be setting f.Offset any more for these fields? |
FWIW, I've been wanting to decouple parameter layout from |
I also think that's the right direction. If nothing depends on field.Offset, we could try not changing that. And have everything in the backend to use ABIParamAssignment.FrameOffset or something alike. |
OK, I'll poke at this and see if I can prune away the ABI field offset update. I did find one suspicious use at but I am pretty sure I can work around it. |
That code is probably okay. It seems that is only for stack-allocated defer calls. If regabi is used, deferred function is argumentless, so it won't execute that line. Maybe you could condition it on GOEXPERIMENT not being enabled. |
Yes, exactly. |
Change https://golang.org/cl/336629 mentions this issue: |
Change https://golang.org/cl/336610 mentions this issue: |
We now understand the root cause of #47227, it will be fixed in #47317. Change-Id: Ifcd44f887a0bd3195818df33e409bd3e818e0b27 Reviewed-on: https://go-review.googlesource.com/c/go/+/336610 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Out of curiosity, where does 052da57 leave us w.r.t. this? Is f.Offset still needed by the backend for function parameters? It looks like maybe not? |
It was used in exactly one place in the backend, which I changed to not use that. Now it should not be used. On the dev.typeparams branch it should already be not used in the backend. The code I changed in the CL is already gone. |
Ah, great. Thanks for the clarification. |
What version of Go are you using (
go version
)?tip (49402be)
Does this issue reproduce with the latest release?
Reproducible with 1.17RC1
Not with 1.16.
What operating system and processor architecture are you using (
go env
)?darwin/amd64
What did you do?
Compiling code that calls an ABI0 function using a func value, on a register-ABI platform.
x.go
a.s
What did you expect to see?
Build successfully.
What did you see instead?
In the case above,
G
is an ABI0 function. It is called via a func value (g
). As far as I can tell, the ABI analysis for the call (g(1)
) correctly uses ABIInternal (for ABI config), but the function's*Type
being analyzed is the same*Type
as the definition of ABI0G
. Perhaps the lineg := G
just makesg
the same*Type
asG
.@aclements @thanm @dr2chase what ensures that we always put the ABIInternal reference to a func value? What do we do with its
*Type
? The ABI analysis associates parameter/result offsets to the fields of function*Type
. So if an ABI0 reference and an ABIInternal reference have the same*Type
pointer, it blows up.If I add an explicit type definition,
var g func(int) [2]int = G
, it compiles fine.Originally found by @mdempsky and @cuonglm when investigating #47227. See also CL https://go-review.googlesource.com/c/go/+/334883 .
The text was updated successfully, but these errors were encountered: