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: does not recognize DW_AT_specification generated by GCC 6 #13344

ianlancetaylor opened this issue Nov 20, 2015 · 1 comment


Copy link

commented Nov 20, 2015

The future GCC 6 is making heavier use of DW_AT_specification, which cgo does not understand. This was reported against gccgo as, but it is a general Go problem. Filing this here to consider adding the patch (which I will send out momentarily) to Go 1.5.2.

The bug can occur in various ways, but the simplest is when there is both an external declaration for a variable and a real declaration, as in

// extern int i;
// int i;
import "C"

Of course in practice the extern int i; would be in a header file. GCC 6 now generates a DW_AT_specification pointing from one declaration to the other. (This is part of the early debug work described at .) The cgo tool sees a variable entry that uses DW_AT_specification, an entry that has no name or type, and issues a "malformed DWARF TagVariable entry" error.

@ianlancetaylor ianlancetaylor self-assigned this Nov 20, 2015

@ianlancetaylor ianlancetaylor added this to the Go1.5.2 milestone Nov 20, 2015


This comment has been minimized.

Copy link

commented Nov 20, 2015

CL mentions this issue.

ianlancetaylor added a commit that referenced this issue Nov 23, 2015
[release-branch.go1.5] cmd/cgo: ignore vars with no name or type if t…
…hey have a AttrSpecification

Fixes #13344.

Change-Id: I33c6721fd33d144c85c87840ddf27ce15aa72328
Run-TryBot: Ian Lance Taylor <>
TryBot-Result: Gobot Gobot <>
Reviewed-by: Minux Ma <>
Reviewed-by: Ian Lance Taylor <>

@golang golang locked and limited conversation to collaborators Nov 27, 2016

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.