On Thu, Jun 18, 2020 at 1:54 AM Florin Pățan <florinpa...@gmail.com> wrote: > > According to the Go 1.15 documentation, the change introduced in > https://golang.org/cl/229578 should change the program behavior, and users > are expected to perform modifications to their code. > > > Package unsafe's safety rules allow converting an unsafe.Pointer into > > uintptr when calling certain functions. Previously, in some cases, the > > compiler allowed multiple chained conversions (for example, > > syscall.Syscall(…, uintptr(uintptr(ptr)), …)). The compiler now requires > > exactly one conversion. Code that used multiple conversions should be > > updated to satisfy the safety rules. > > After reading that paragraph, I expect that the compiler fails to compile > code after that change. When running `go build` or `go build > -gcflags="-d=checkptr"` neither produce a failure. I used `go vet`, and that > doesn't catch this change either. > > The example I used is https://play.golang.org/p/a0B4kxLEAjb. > > Perhaps I failed to construct a correct example, in which case help would be > appreciated. > > I was not sure if this belongs to the mailing list or the issue tracker, so I > started here.
What has changed is that the compiler does not keep multiply-casted pointers live across the call to syscall.Syscall. Our assumption was that nobody actually wrote code like that. Why would they? Do you know of any real code that does this? If there is no real code, then it doesn't seem worth spending the time to write checks. If we were going to do that, we might as well instead spend the time to let the code continue to work. 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 on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcXL-2A5yCBO8bDfyYfZMxuepg3e0J0koLHVsDYGgzLbrg%40mail.gmail.com.