From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19779 invoked by alias); 23 Oct 2015 17:15:22 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 19631 invoked by uid 48); 23 Oct 2015 17:15:14 -0000 From: "vogt at linux dot vnet.ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug go/67976] Cgo + Gccgo not working like Cgo + Golang? Date: Fri, 23 Oct 2015 17:15:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: go X-Bugzilla-Version: 6.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vogt at linux dot vnet.ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: ian at airs dot com X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-10/txt/msg01969.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67976 --- Comment #1 from Dominik Vogt --- When cgo encounters the "C.foo_cgo", it determines that it must be a variable, but finds no C definition, so it generates "extern char foo_cgo[]" (out.go) as the type. This conflicts with the declaration in the comment at the beginning of the file. Replacing /* int foo_cgo(unsigned); */ with /* extern char foo_cgo[]; */ Makes this code compile for me. Is this kind of declaration supported by the cgo version from the golang repository? (If not, what would the symbol C.foo_cgo be good for).