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/compile: Wrong line number in stack trace in this particular panic (from Go stdlib) #6586

Closed
mitchellh opened this issue Oct 14, 2013 · 7 comments

Comments

@mitchellh
Copy link

go version:
go version devel +4971493b0e14 Tue Oct 01 23:44:20 2013 -0400 darwin/amd64

the code:
https://gist.github.com/mitchellh/3883097d9d57fccbfb88

(the code actually works fine on play.golang.org, I'm not sure what changed in Go 1.2
but on 1.2 this panics)

The panic looks like this. If you look, the line number of `net.(*TCPConn).Close` is on
line 1 in dial.go. Is this working as intended? It made debugging this trickier.

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xb code=0x1 addr=0x0 pc=0x35077]

goroutine 1 [running]:
runtime.panic(0x74e40, 0x114e19)
    /Users/mitchellh/go/src/pkg/runtime/panic.c:266 +0xb6
net.(*TCPConn).Close(0x0, 0x7b6a0, 0x117228)
    /Users/mitchellh/go/src/pkg/net/dial.go:1 +0x17
main.main()
    /tmp/test/test.go:10 +0x41
exit status 2
@davecheney
Copy link
Contributor

Comment 1:

Issue #6585 has been merged into this issue.

@ianlancetaylor
Copy link
Contributor

Comment 2:

net.(*TCPConn).Close is a method that TCPConn inherits from the conn type, which is an
interface.  This is presumably a method stub generated by the compiler that translates
tcpconn.Close() into tcpconn.conn.Close().  The compiler should generate better line
number information for this stub; I'm not sure what it should generate, but dial.go:1 is
actively misleading.  If we can't think of anything else, it would be better to say
<unknown> or <generated> than to say dial.go:1.

Labels changed: added priority-later, removed priority-triage.

@robpike
Copy link
Contributor

robpike commented Oct 14, 2013

Comment 3:

Status changed to Accepted.

@rsc
Copy link
Contributor

rsc commented Nov 27, 2013

Comment 4:

Labels changed: added go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 5:

Labels changed: added release-none, removed go1.3maybe.

@rsc
Copy link
Contributor

rsc commented Dec 4, 2013

Comment 6:

Labels changed: added repo-main.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@rsc rsc changed the title cmd/gc: Wrong line number in stack trace in this particular panic (from Go stdlib) cmd/compile: Wrong line number in stack trace in this particular panic (from Go stdlib) Jun 8, 2015
@ALTree
Copy link
Member

ALTree commented Oct 7, 2017

it would be better to say <unknown> or <generated> than to say dial.go:1.

1.9 compiler does that:

goroutine 1 [running]:
net.(*TCPConn).Close(0x0, 0xc42004df70, 0x48a224)
	<autogenerated>:1 +0x5
main.main()
	test.go:10 +0x2a

So this issue is fixed. Closing.

@ALTree ALTree closed this as completed Oct 7, 2017
@golang golang locked and limited conversation to collaborators Oct 7, 2018
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

7 participants