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: segfault after inlining cgo function (-l=4) #18125

Closed
davidlazar opened this issue Nov 30, 2016 · 1 comment
Closed

cmd/compile: segfault after inlining cgo function (-l=4) #18125

davidlazar opened this issue Nov 30, 2016 · 1 comment

Comments

@davidlazar
Copy link
Member

x.go:

package main

import "C"

func main() {
	C.CString("foo")
}

Compiling:

$ go build -gcflags '-m -l=4' x.go
/tmp/go-build562940151/command-line-arguments/_obj/_cgo_gotypes.go:14: can inline _Cgo_ptr
/tmp/go-build562940151/command-line-arguments/_obj/_cgo_gotypes.go:51: can inline _cgo_cmalloc
/tmp/go-build562940151/command-line-arguments/_obj/_cgo_gotypes.go:37: can inline _Cfunc_CString
/tmp/go-build562940151/command-line-arguments/_obj/_cgo_gotypes.go:38: inlining call to _cgo_cmalloc
./x.go:5: can inline main
./x.go:6: inlining call to _Cfunc_CString
./x.go:6: inlining call to _cgo_cmalloc
...

$ go version
go version go1.7.3 linux/amd64

Running:

$ ./x
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x40131c]

goroutine 1 [running]:
panic(0x45c5e0, 0xc42000c120)
	/usr/lib/go/src/runtime/panic.go:500 +0x1a1
main.main()
	/home/david/x.go:6 +0x4c
@davidlazar davidlazar self-assigned this Nov 30, 2016
@gopherbot
Copy link

CL https://golang.org/cl/33722 mentions this issue.

@golang golang locked and limited conversation to collaborators Dec 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants