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: bad //line generation #8488

Closed
mdempsky opened this issue Aug 7, 2014 · 3 comments

Comments

@mdempsky
Copy link
Member

commented Aug 7, 2014

See https://golang.org/cl/118690044/#msg3

$ cat -n issue7757.go
     1  // Copyright 2014 The Go Authors.  All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package main
     6  
     7  /*
     8  void foo() {}
     9  */
    10  import "C"
    11  
    12  func main() {
    13      C.foo = C.foo // ERROR HERE
    14  }

$ go tool cgo issue7757.go

$ cat _obj/issue7757.cgo1.go
// Created by cgo - DO NOT EDIT

//line /usr/local/google/home/mdempsky/wd/go2/misc/cgo/errors/issue7757.go:5
package main
//line /usr/local/google/home/mdempsky/wd/go2/misc/cgo/errors/issue7757.go:13

//line /usr/local/google/home/mdempsky/wd/go2/misc/cgo/errors/issue7757.go:12
func main() {
//line /usr/local/google/home/mdempsky/wd/go2/misc/cgo/errors/issue7757.go:12
    _Cgo_ptr(_Cfpvar_fp_foo) = _Cgo_ptr(_Cfpvar_fp_foo)
//line /usr/local/google/home/mdempsky/wd/go2/misc/cgo/errors/issue7757.go:14
}


Because of the "//line" output, the go compiler thinks the illegal assignment
error is on line 12, when it actually came from line 13.
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 7, 2014

Comment 1:

Labels changed: added repo-main, release-none, suggested.

Status changed to Accepted.

@gopherbot

This comment has been minimized.

Copy link

commented Aug 8, 2014

Comment 2:

CL https://golang.org/cl/118690044 mentions this issue.
@ianlancetaylor

This comment has been minimized.

Copy link
Contributor

commented Aug 12, 2014

Comment 3:

This issue was closed by revision 11016f6.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016

wheatman added a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
wheatman added a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.