Skip to content

Commit

Permalink
cmd/gc: mark OGOTO as a statement for formatters.
Browse files Browse the repository at this point in the history
Nodes of goto statements were corrupted when written
to export data.

Fixes golang#7023.

R=rsc, dave, minux.ma
CC=golang-codereviews
https://golang.org/cl/46190043
  • Loading branch information
remyoudompheng committed Jan 10, 2014
1 parent 8449863 commit f739dae
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cmd/gc/fmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ static int opprec[] = {
[OEMPTY] = -1,
[OFALL] = -1,
[OFOR] = -1,
[OGOTO] = -1,
[OIF] = -1,
[OLABEL] = -1,
[OPROC] = -1,
Expand Down
10 changes: 10 additions & 0 deletions test/fixedbugs/issue7023.dir/a.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package a

func Foo() {
goto bar
bar:
}
11 changes: 11 additions & 0 deletions test/fixedbugs/issue7023.dir/b.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package b

import (
"./a"
)

var f = a.Foo
10 changes: 10 additions & 0 deletions test/fixedbugs/issue7023.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// compiledir

// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// Issue 7023: corrupted export data when an inlined function
// contains a goto.

package ignored

0 comments on commit f739dae

Please sign in to comment.