-
Notifications
You must be signed in to change notification settings - Fork 18k
cmd/vet: crash of go vet involving cgo #18389
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
Comments
With Go 1.8 coming out soon, we're no longer making changes to the Go 1.7 codebase. Can you check whether this bug is present in Go 1.8?
|
yes. i am getting 1.8 to build from source. this looks like an easy change. |
I'm editing origin |
and I tried it with the
|
I'll let @ianlancetaylor triage this for Go1.8 vs Go1.9. |
When running go vet on a code base using cgo, we get infinite recursion during the check: ``` go vet ./... ``` The same type parameter goes in (0x3f0b20), and infinite recursion ensues: ``` main.typeOKForCgoCall(0x3f0b20, 0xc420493f30, 0xc42046d001) /usr/local/go/src/cmd/vet/cgo.go:119 +0x160 fp=0xc440701a38 sp=0xc4407019f8 main.typeOKForCgoCall(0x3f0ae0, 0xc42049cc60, 0xc420493f30) /usr/local/go/src/cmd/vet/cgo.go:124 +0x104 fp=0xc440701a78 sp=0xc440701a38 main.typeOKForCgoCall(0x3f0b20, 0xc420493f30, 0xc42046d001) /usr/local/go/src/cmd/vet/cgo.go:119 +0x160 fp=0xc440701ab8 sp=0xc440701a78 ``` These pointers in this case happen to be a `openssl.Certificate` and a `*openssl.Certificate`, with Underlying() of `*type.Pointer` and `*type.Struct`. This function either returns immediately when the answer is yes, or immediately return no, or recurse when the answer is possibly no. So if we see the same type twice in the list of parents from which the recursion began, then the answer must be no - because it will never change to a yes. Fixes golang#18389
@rfielding Thanks, but please don't send us patches except through Gerrit, since Gerrit ensures that we have the right to use the patch. |
@bradfitz Looks like CL 32754 may have caused cmd/vet to stop running the cgo tests. Hmmm. |
I won't insist on it, but I think it would be better to fix this for 1.8 since it's fairly annoying to have vet crash on valid code and there is no sensible workaround. |
CL https://golang.org/cl/34660 mentions this issue. |
What version of Go are you using (
go version
)?go version go1.7.4 darwin/amd64
go vet
crashes with an infinite recursion in cgo.go:This code uses the spacemonkey/openssl library. The error happens during vet in cgo.go:
This seems plausible if
t
has at.Field(i).Type()
reaches the same type. In my case, it reaches the same type with period 2.The text was updated successfully, but these errors were encountered: