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/cgo: panic instead of error for insufficient arguments to C function #16116

Closed
qeedquan opened this issue Jun 19, 2016 · 3 comments

Comments

@qeedquan
Copy link
Contributor

commented Jun 19, 2016

Please answer these questions before submitting your issue. Thanks!

  1. What version of Go are you using (go version)?
    go 1.7 beta 2
  2. What operating system and processor architecture are you using (go env)?
    Linux amd64
  3. What did you do?
    If possible, provide a recipe for reproducing the error.
    A complete runnable program is good.
    A link on play.golang.org is best.

https://play.golang.org/p/4NVQYgjnhx

  1. What did you expect to see?
    A compile error
  2. What did you see instead?
panic: runtime error: index out of range

goroutine 1 [running]:
panic(0x5876a0, 0xc4200141d0)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
main.(*Package).rewriteCall(0xc42001c5a0, 0xc42000a240, 0xc420014b10, 0xc420090300)
    /usr/local/go/src/cmd/cgo/gcc.go:628 +0x1645
main.(*Package).rewriteCalls(0xc42001c5a0, 0xc42000a240)
    /usr/local/go/src/cmd/cgo/gcc.go:593 +0x167
main.(*Package).Translate(0xc42001c5a0, 0xc42000a240)
    /usr/local/go/src/cmd/cgo/gcc.go:170 +0x112
main.main()
    /usr/local/go/src/cmd/cgo/main.go:290 +0x726

It seems that Issue 13423 isnt fully fixed because the check can break early in the presence of void pointers as shown in the code example so it can still get out of bounds

@gopherbot

This comment has been minimized.

Copy link

commented Jun 19, 2016

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

@quentinmit quentinmit added the NeedsFix label Jun 20, 2016

@quentinmit quentinmit added this to the Go1.7Maybe milestone Jun 20, 2016

@quentinmit

This comment has been minimized.

Copy link
Contributor

commented Jun 20, 2016

I'm going to tentatively put this in Go 1.7, but realistically it will probably get pushed to 1.8.

@gopherbot

This comment has been minimized.

Copy link

commented Jun 21, 2016

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

@gopherbot gopherbot closed this in d282427 Jun 21, 2016

@golang golang locked and limited conversation to collaborators Jun 21, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.