Memory beats git bisect, but this was indeed fixed by a1ddbdd3ef8b739aab53f20d6ed0a61c3474cf12.
On Saturday, July 5, 2025 at 6:36:57 PM UTC+2 Ian Lance Taylor wrote: > On Sat, Jul 5, 2025 at 8:24 AM Ge <everg...@gmail.com> wrote: > > > > As follows showing, when `-N` is enabled with compiler, it gives the > expected output. > > ``` > > ➜ grd more nf2.go > > package main > > > > import "os" > > > > func main() { > > f, err := os.Open("nonExistFile") > > fname := f.Name() > > if err != nil { > > println("failed to open file, Error:", err.Error()) > > return > > } > > > > println("filename:", fname) > > } > > ➜ grd go run nf2.go > > failed to open file, Error: open nonExistFile: no such file or directory > > > > ➜ grd go run -gcflags="-N" nf2.go > > panic: runtime error: invalid memory address or nil pointer dereference > > [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x4782e3] > > > > goroutine 1 [running]: > > os.(*File).Name(...) > > /usr/local/go/src/os/file.go:62 > > main.main() > > /root/grd/nf2.go:7 +0x123 > > exit status 2 > > > > ➜ grd go version > > go version go1.24.4 linux/amd64 > > ``` > > This may be https://go.dev/issue/72860. In any case, it works > correctly (that is, it panics) on HEAD and the upcoming Go 1.25 > release. > > Ian > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/8f4f85f8-ff03-445a-af25-c7181e36f223n%40googlegroups.com.