Skip to content
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: -d=checkptr doesn't work with named unsafe.Pointer types #34966

Closed
mdempsky opened this issue Oct 17, 2019 · 1 comment
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@mdempsky
Copy link
Member

This package fails to compile with -d=checkptr:

package p

import "unsafe"

type P unsafe.Pointer

func f(p P) *int { return (*int)(p) }
func g(p P) P    { return P(uintptr(p) + 1) }

This is because the runtime functions have unsafe.Pointer parameters, but currently when inserting instrumentation, we pass the unsafe pointers as-is (i.e., as P-typed above, which isn't assignable to unsafe.Pointer).

Fix is to just add appropriate explicit conversions in the instrumentation.

Reported by Asif Jalil on golang-dev.

@mdempsky mdempsky added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 17, 2019
@mdempsky mdempsky added this to the Go1.14 milestone Oct 17, 2019
@mdempsky mdempsky self-assigned this Oct 17, 2019
@gopherbot
Copy link

Change https://golang.org/cl/201782 mentions this issue: cmd/compile: fix -d=checkptr for named unsafe.Pointer types

@golang golang locked and limited conversation to collaborators Oct 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants