You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There appears to be a regression in cgo, where when a C function is called with not enough arguments, it causes cgo to panic instead of printing a meaningful error:
In go 1.4 go build prints out: ./foo.go:8: not enough arguments in call to _Cfunc_sin
At tip, the output is a panic during the execution of cgo:
panic: runtime error: index out of range
goroutine 1 [running]:
main.(*Package).rewriteCall(0xc82009e0f0, 0xc820082120, 0xc820076b00, 0xc8200a0180)
/Users/cookieo9/local/go/src/cmd/cgo/gcc.go:606 +0xc58
main.(*Package).rewriteCalls(0xc82009e0f0, 0xc820082120)
/Users/cookieo9/local/go/src/cmd/cgo/gcc.go:593 +0x1f8
main.(*Package).Translate(0xc82009e0f0, 0xc820082120)
/Users/cookieo9/local/go/src/cmd/cgo/gcc.go:170 +0x197
main.main()
/Users/cookieo9/local/go/src/cmd/cgo/main.go:275 +0x1055
Going the other way (i.e.: having too many arguments) produces the same error as go 1.4: ./foo.go:8: too many arguments in call to _Cfunc_sin
The only function I tested which doesn't panic, and prints the correct error is malloc, although I believe that's a result of special handling for malloc. Other functions I tested included "strcpy", "strlen", and "calloc" (from https://groups.google.com/forum/#!topic/golang-dev/TquSAX-w6NA).
I have tested this at tip on darwin-amd64 (El Capitain), and linux-arm (Raspberry Pi 2)
The text was updated successfully, but these errors were encountered:
This bug was introduced by 9dcc58c (cmd/cgo, runtime: add checks for passing pointers from Go to C). The code assumes that the call has at least as many arguments as the function definition requires.
There appears to be a regression in cgo, where when a C function is called with not enough arguments, it causes cgo to panic instead of printing a meaningful error:
In go 1.4 go build prints out:
./foo.go:8: not enough arguments in call to _Cfunc_sin
At tip, the output is a panic during the execution of cgo:
Going the other way (i.e.: having too many arguments) produces the same error as go 1.4:
./foo.go:8: too many arguments in call to _Cfunc_sin
The only function I tested which doesn't panic, and prints the correct error is malloc, although I believe that's a result of special handling for malloc. Other functions I tested included "strcpy", "strlen", and "calloc" (from https://groups.google.com/forum/#!topic/golang-dev/TquSAX-w6NA).
I have tested this at tip on darwin-amd64 (El Capitain), and linux-arm (Raspberry Pi 2)
The text was updated successfully, but these errors were encountered: