Skip to content

cmd/compile: C.malloc fails with -d=checkptr #34968

@mdempsky

Description

@mdempsky
$ cat malloc.go
package main

// #include <stdlib.h>
import "C"

func main() {
	println(C.malloc(1000))
}
$ go run -gcflags=all=-d=checkptr malloc.go
fatal error: runtime: C malloc failed

goroutine 1 [running]:
runtime.throw(0x47aea6, 0x18)
	/usr/local/google/home/mdempsky/wd/go/src/runtime/panic.go:774 +0x72 fp=0xc000082708 sp=0xc0000826d8 pc=0x426122
main._cgo_cmalloc(0x3e8, 0x0)
	_cgo_gotypes.go:55 +0x91 fp=0xc000082738 sp=0xc000082708 pc=0x4576a1
main._Cfunc__CMalloc(...)
	_cgo_gotypes.go:40
main.main()
	/tmp/malloc.go:7 +0x2a fp=0xc000082760 sp=0xc000082738 pc=0x4576da
...

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