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: with -compiler=gccgo can't compile function pointer type with cgo exported feature #8945

Closed
gopherbot opened this issue Oct 16, 2014 · 6 comments
Milestone

Comments

@gopherbot
Copy link

by Snyh1010:

What does 'go version' print?
go version devel +a622a4ff09da Fri Jul 18 13:05:21 2014 +0400 linux/amd64               
    
and
go version go1.3.1 linux/amd64

What steps reproduce the problem?
use go build -compiler=gccgo to compile below code
http://play.golang.org/p/77fSej3teX


What happened?
snyh:xx$go build -compiler=gccgo 
# _/run/shm/xx
In file included from $WORK/_/run/shm/xx/_obj/_cgo_main.c:8:0:
./a.go:4:7: error: conflicting types for ‘success_cb’
 //PFunc success_cb;
       ^
/tmp/go-build297076724/_/run/shm/xx/_obj/_cgo_main.c:5:13: note: previous declaration of
‘success_cb’ was here
 extern char success_cb[];
             ^


Please provide any additional information below.
@gopherbot
Copy link
Author

Comment 1 by Snyh1010:

src/cmd/cgo/out.go:105  
write the error prototype for the function pointer type.

@gopherbot
Copy link
Author

Comment 2 by Snyh1010:

Is the _cgohack_ still useful?  I can't find any information about the "void *_cgohack_"
which caused this issues.
remove this hack can fix this issues.

@ianlancetaylor
Copy link
Contributor

Comment 3:

The _cgohack_ code is for issue #1334.  The change that committed it
(http://golang.org/cl/3746041) included a test case, so it should be
straightforward to determine whether it is still needed.
In any case I'm fairly certain it's not needed for gccgo, and could be omitted when
*gccgo is true.

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

Status changed to Accepted.

@gopherbot
Copy link
Author

Comment 4 by Snyh1010:

I have request a simple CL with a test case to fix this. 
https://golang.org/cl/154360045/
I have test it with gcc and clang and it's ok, but how can I run build script  with
gccgo test enable?

@ianlancetaylor
Copy link
Contributor

Comment 5:

If I understand what you are asking, you can't.  The run.sh script is for gc, not gccgo.
 But that's OK: if your CL fixes the go build -compiler=gccgo case, go ahead and mail it.

@gopherbot
Copy link
Author

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

@rsc rsc closed this as completed in 4e61c51 Jun 29, 2015
@golang golang locked and limited conversation to collaborators Jun 28, 2016
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

4 participants