/ go Public
cmd/compile: -d=checkptr should provide more details when reporting about conversions that straddle multiple allocations #40639
Issues related to the Go compiler and/or runtime.
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
Does this issue reproduce with the latest release?
What operating system and processor architecture are you using (
What did you do?
dataOffset += 2 * copy((*[1 << 16]uint16)(unsafe.Pointer(&nextData))[:], c.array())
(Context actually mostly irrelevant; what's important is the lack of explicit length/cap on the slice.)
What did you expect to see?
checkptr thinking i totally know what i'm doing, or telling me what's wrong
What did you see instead?
"unsafe pointer conversion"
I mentioned this in passing because I thought it was complaining that we couldn't prove that the pointer was aligned, but bcmills pointed me at the CL for having checkptr not complain about unaligned access when it's to non-pointer-typed data. Another user (hi kale!) pointed out a more subtle issue: https://go-review.googlesource.com/c/sys/+/225418
It turns out checkptr also complains about slices which lack a length/capacity. That's completely reasonable, but I didn't know it was one of the rules checkptr would enforce, and the diagnostic didn't say what it was doing.
Suggestion: checkptr diagnostics should be distinct, and say things like "potential misalignment", or "slice without length or capacity" or something else that would make it more immediately obvious what it's complaining about.
(It's right, though.)
The text was updated successfully, but these errors were encountered: