]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: mark OGOTO as a statement for formatters.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Fri, 10 Jan 2014 00:33:24 +0000 (01:33 +0100)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Fri, 10 Jan 2014 00:33:24 +0000 (01:33 +0100)
Nodes of goto statements were corrupted when written
to export data.

Fixes #7023.

R=rsc, dave, minux.ma
CC=golang-codereviews
https://golang.org/cl/46190043

src/cmd/gc/fmt.c
test/fixedbugs/issue7023.dir/a.go [new file with mode: 0644]
test/fixedbugs/issue7023.dir/b.go [new file with mode: 0644]
test/fixedbugs/issue7023.go [new file with mode: 0644]

index 4217321831b9e58092029687a7fa783e0ff07fcb..6f40c7ff305e0ff44eef5ded20c2747e6f152441 100644 (file)
@@ -1039,6 +1039,7 @@ static int opprec[] = {
        [OEMPTY] = -1,
        [OFALL] = -1,
        [OFOR] = -1,
+       [OGOTO] = -1,
        [OIF] = -1,
        [OLABEL] = -1,
        [OPROC] = -1,
diff --git a/test/fixedbugs/issue7023.dir/a.go b/test/fixedbugs/issue7023.dir/a.go
new file mode 100644 (file)
index 0000000..cdb5432
--- /dev/null
@@ -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:
+}
diff --git a/test/fixedbugs/issue7023.dir/b.go b/test/fixedbugs/issue7023.dir/b.go
new file mode 100644 (file)
index 0000000..c6fe40d
--- /dev/null
@@ -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
diff --git a/test/fixedbugs/issue7023.go b/test/fixedbugs/issue7023.go
new file mode 100644 (file)
index 0000000..f18c611
--- /dev/null
@@ -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