Skip to content

cmd/compile: -d=checkptr doesn't work with named unsafe.Pointer types #34966

Closed
@mdempsky

Description

@mdempsky

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions