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
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@qeedquan
Copy link
Contributor

qeedquan 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
Copy link

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

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Jun 20, 2016
@quentinmit quentinmit added this to the Go1.7Maybe milestone Jun 20, 2016
@quentinmit
Copy link
Contributor

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

@gopherbot
Copy link

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

@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.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

3 participants