Skip to content

fmt: bad pointer in frame fmt.(*pp).printValue #64111

@gucio321

Description

@gucio321

What version of Go are you using (go version)?

$ go version
go version go1.21.4 linux/amd64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/my-username/.cache/go-build'
GOENV='/home/my-username/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/my-username/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/my-username/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build497266722=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I'm writting a wrapper of C void* pointer via CGO. I'm getting the following panic:

runtime: bad pointer in frame fmt.(*pp).printValue at 0xc00022d758: 0x1
fatal error: invalid pointer found on stack

Code causing this looks as follows:

        v := texture.ID()
        fmt.Println("%T\n", v)

BUT when I add this single line:

        fmt.Println(texture)
        v := texture.ID()
        fmt.Println("%T\n", v)

This works perfectly.

Full project (as I'm unable to extract a single reproduction code) is here:
https://github.com/gucio321/cimgui-go/tree/callbacks

What did you expect to see?

No panic should happen

What did you see instead?

Panic

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.compiler/runtimeIssues related to the Go compiler and/or runtime.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions