Skip to content

gofmt -r crashes with specific rewrite rules #1384

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
gopherbot opened this issue Jan 5, 2011 · 2 comments
Closed

gofmt -r crashes with specific rewrite rules #1384

gopherbot opened this issue Jan 5, 2011 · 2 comments

Comments

@gopherbot
Copy link
Contributor

by imgx64:

Before filing a bug, please check whether it has been fixed since
the latest release: run "hg pull -u" and retry what you did to
reproduce the problem.  Thanks.

What steps will reproduce the problem?
Run any of the following:
echo 'package main' | gofmt -r 'x->foo'
echo -e 'package main\nvar x int' | gofmt -r 'x->foo'
echo -e 'package main\nvar xx int' | gofmt -r 'xx->foo'
echo -e 'package main\nvar xx int = yy+zz' | gofmt -r 'a+b->a*b'

What is the expected output?
Input is correctly formatted and the rewrite rule applied.

What do you see instead?
panic: runtime error: invalid memory address or nil pointer dereference

panic PC=0x7fd6407bcba8
runtime.panic+0xa7 /opt/go/src/pkg/runtime/proc.c:1032
    runtime.panic(0x498e5c, 0x7fd6407ff2a0)
runtime.panicstring+0x69 /opt/go/src/pkg/runtime/runtime.c:83
    runtime.panicstring(0x5ab8bf, 0x4c6da8)
runtime.sigpanic+0x144 /opt/go/src/pkg/runtime/linux/thread.c:286
    runtime.sigpanic()
go/ast.*CommentGroup·Pos+0x1c /opt/go/src/pkg/go/ast/ast.go:85
    go/ast.*CommentGroup·Pos(0x0, 0x49c114, 0x0, 0x7fd6407b8b10)
main._func_003+0x1bf /opt/go/src/cmd/gofmt/rewrite.go:61
    main._func_003(0x7fd6407b7268, 0x7fd6407b7280, 0x7fd6407ff280, 0x7fd6407ff290, 0x402388, ...)
main.apply+0x24d /opt/go/src/cmd/gofmt/rewrite.go:94
    main.apply(0x7fd6407cb9b0, 0x7fd6407e8480, 0x7fd6407dc720, 0x7fd6407dc720, 0x7fd6407ff280, ...)
main.rewriteFile+0x1bc /opt/go/src/cmd/gofmt/rewrite.go:65
    main.rewriteFile(0x7fd6407d0700, 0x7fd6407dc7e0, 0x7fd6407d0700, 0x7fd6407dc7c0, 0x7fd6407d0b80, ...)
main._func_002+0x41 /opt/go/src/cmd/gofmt/rewrite.go:31
    main._func_002(0x7fd6407ff3f0, 0x7fd6407ff370, 0x40106e, 0x7fd6407d0b80, 0x4767dc, ...)
main.processFile+0x1ec /opt/go/src/cmd/gofmt/gofmt.go:109
    main.processFile(0x7fd6407b83c0, 0x500000000, 0x7fd6407e1540, 0x40852e)
main.main+0x159 /opt/go/src/cmd/gofmt/gofmt.go:202
    main.main()
runtime.mainstart+0xf /opt/go/src/pkg/runtime/amd64/asm.s:77
    runtime.mainstart()
runtime.goexit /opt/go/src/pkg/runtime/proc.c:148
    runtime.goexit()


Which compiler are you using (5g, 6g, 8g, gccgo)?
6g

Which operating system are you using?
Linux, Ubuntu 10.04

Which revision are you using?  (hg identify)
e86b22981073 tip

Please provide any additional information below.
I can't find a pattern to crashes. They might be more than one bug.
@robpike
Copy link
Contributor

robpike commented Jan 6, 2011

Comment 1:

Owner changed to [email protected].

Status changed to Accepted.

@griesemer
Copy link
Contributor

Comment 2:

This issue was closed by revision 9d634e5.

Status changed to Fixed.

@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