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: randomly produces spurious errors involving incompatible C types #8463

Closed
gopherbot opened this issue Aug 2, 2014 · 6 comments
Closed

Comments

@gopherbot
Copy link

by ianremmler:

What does 'go version' print?

go version go1.3 linux/amd64

What steps reproduce the problem?
If possible, include a link to a program on play.golang.org.

http://play.golang.org/p/gQM33-crSr

Running go build will, about 15% of the time, produce a seemingly spurious error.

What happened?

ian@tau:~/devel/go/src/github.com/ianremmler/foobar% go build
# github.com/ianremmler/foobar
./foobar.go:31: cannot use f (type *C.foo) as type *C.struct_foo in argument to toGo
./foobar.go:32: cannot use gf.toC() (type *C.struct_foo) as type *C.foo in argument to
_Cfunc_foofunc

What should have happened instead?

No error.

Please provide any additional information below.

This is a pared down example based on a wrapper for the chipmunk physics library that I
forked and have been (mildy) maintaining:

https://github.com/ianremmler/chipmunk

The error did not occur in earlier Go versions.  The cyclically dependent C structs seem
to be implicated as the error goes away if the bar pointer is removed from foo, or vice
versa.
@gopherbot
Copy link
Author

Comment 1 by ianremmler:

Interestingly, duplicating the typedefs eliminates the error:
http://play.golang.org/p/si1Dc5Wr_r

@ianlancetaylor
Copy link
Contributor

Comment 2:

Very odd.  It sometimes works and sometimes fails.

Labels changed: added repo-main, release-go1.3.1.

Status changed to Accepted.

@ianlancetaylor
Copy link
Contributor

Comment 3:

Status changed to Duplicate.

Merged into issue #8441.

@ianlancetaylor
Copy link
Contributor

Comment 4:

Issue #8302 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Aug 11, 2014

Comment 5:

Issue #8302 has been merged into this issue.

@rsc
Copy link
Contributor

rsc commented Aug 11, 2014

Comment 6:

Labels changed: added release-none, removed release-go1.3.1.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants