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: []byte argument has Go pointer to Go pointer #28606
Comments
cgo isn't clever enough to look at where the arguments are coming from. It should work if you write it as C.f(unsafe.Pointer(&p[0])) |
Hi @ianlancetaylor . Is this something that does not need to be addressed anymore? If so, can we close the issue. If not, I would love to pick it up as a first issue |
As far as I know, this still happens. The program above still fails in the same way. If you want to look at this, that would be great. But I want to caution you that I don't think this will be easy to fix. At the moment I don't really see how to fix it at all. |
Awesome. I'm delighted to investigate it and try some options. Reproducing it first.. |
@ianlancetaylor sorry I have been unavailable for a while due to some unforeseen circumstances.
That would explain why this is able to work just fine as you mentioned earlier when the expressions are combined.
I would love to also look at how the type conversion is implemented. Can you point me in any direction of where this is? Thanks |
The relevant code here is cmd/cgo/gcc.go, around the method I don't think there is going to be any simple fix here. I think that fixing this will require a significant change to how the cgo tool works. |
With Go 1.11 and HEAD:
go version devel +a2a3dd00c9 Thu Sep 13 09:52:57 2018 +0000 darwin/amd64
, the following program:Panics:
I suspect (but cannot yet show that) this is related to the fact that gzip.Writer is passing a []byte to the Write method made out of an array field of the gzip.Writer struct.
The text was updated successfully, but these errors were encountered: