Skip to content

gofmt crashes on rewrite #1033

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

Closed
robpike opened this issue Aug 18, 2010 · 2 comments
Closed

gofmt crashes on rewrite #1033

robpike opened this issue Aug 18, 2010 · 2 comments

Comments

@robpike
Copy link
Contributor

robpike commented Aug 18, 2010

What steps will reproduce the problem?
1.
create x.go

package main

func main() {
        _ := new(int)
}

2.

run gofmt -r 'new(a) -> make(*a)'


What is the expected output? What do you see instead?

It should do the rewrite; instead it crashes 

panic: runtime error: invalid memory address or nil pointer dereference

panic PC=0x313718
runtime.panic+0xb2 /Users/r/go/src/pkg/runtime/proc.c:1015
    runtime.panic(0x0, 0x3006a8)
panicstring+0x69 /Users/r/go/src/pkg/runtime/runtime.c:83
    panicstring(0x8eeb0, 0x332090)
sigpanic+0x148 /Users/r/go/src/pkg/runtime/darwin/thread.c:460
    sigpanic()
reflect.*PtrValue·PointTo+0x27 /Users/r/go/src/pkg/reflect/value.go:1062
    reflect.*PtrValue·PointTo(0x0, 0x4fd74, 0x32c5e0, 0xb7e01)
main.subst+0x338 /Users/r/go/src/cmd/gofmt/rewrite.go:227
    main.subst(0x32c600, 0x0, 0x0, 0x3249c0, 0x32c3e0, ...)
...


Please use labels and text to provide additional information.

This is at head.
@griesemer
Copy link
Contributor

Comment 1:

I cannot reproduce this. It also looks very much like the bug that I fixed and submitted
yesterday (Revision: d29b500126,
https://code.google.com/p/go/source/detail?r=d29b5001260b4031b897f9c83b1046aa77989e35 ).
Please verify that you are running the latest version of the reflect package.

Status changed to WaitingForReply.

@robpike
Copy link
Contributor Author

robpike commented Aug 18, 2010

Comment 2:

i was at head when i reported it, but it's fixed now.

Status changed to Fixed.

@robpike robpike added the fixed label Aug 18, 2010
@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
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

3 participants