-
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: unsafe.Sizeof with generic type parameter causes panic #47716
Comments
Thanks for the report, and the investigation. I'm guessing this is a consequence of https://golang.org/cl/335413; Sizeof is no longer necessarily constant. |
Simpler reproducer: package p
import "unsafe"
func _[T any](x T) {
_ = unsafe.Sizeof(x)
} |
Here's a partial fix that avoids the crash. But we should probably check that the compiler's size computation agrees:
cc: @danscales |
To check, the current status is that |
Per the current (in-progress) spec:
|
Change https://golang.org/cl/344250 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
No.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
https://go2goplay.golang.org/p/f14OcREOTZ9
What did you expect to see?
Successful compilation or some compiler error.
What did you see instead?
It seems
g.info.Types[call].Value
isnil
here, butg.info.Types[call]
is not zero value.go/src/cmd/compile/internal/noder/validate.go
Line 84 in 717894c
The text was updated successfully, but these errors were encountered: