-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: call of reflect.Value.Type on zero Value #70156
Comments
cc @golang/compiler (because of the bisect result, sorry if it turns out unrelated) |
Definitely seems to be a miscompilation. Here is a small reproducer. This program should not panic, but it does at HEAD. package main
import (
"reflect"
)
func main() {
pi := new(interface{})
v := reflect.ValueOf(pi).Elem()
if v.Kind() != reflect.Interface {
panic(0)
}
if (v.Kind() == reflect.Ptr || v.Kind() == reflect.Interface) && v.IsNil() {
return
}
panic(1)
} |
use go run -gcflags="-N" . don`t panic |
Change https://go.dev/cl/624695 mentions this issue: |
I think, since the constant parts of the prove pass was rewritten in CL 599096, the limits for the newly created values need to be initialized before use. I have a fix, PTAL. @randall77
|
Change https://go.dev/cl/624855 mentions this issue: |
For: #70156 Change-Id: Ie39a88130f27b4b210ddbcf396cc0ddd2713d58b Reviewed-on: https://go-review.googlesource.com/c/go/+/624855 Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: David Chase <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Mauri de Souza Meneguzzo <[email protected]>
Go version
gotip
Output of
go env
in your module/workspace:What did you do?
What did you see happen?
The test fails with gotip but succeeds with go1.23.2
What did you expect to see?
I expect the test to pass as it does with older Go versions. This package uses some reflection trickery, so I’m not sure if we were relying on incorrect reflection usage.
A bisect suggest the offending commit to be CL 599096.
The text was updated successfully, but these errors were encountered: