Update prebuilts to go1.7rc1 ab/3043704
toolchain/go sha ffb9ee3a
Change-Id: I230dd018def6fd975e28add1eb70aae6c54ad5d7
diff --git a/test/alg.go b/test/alg.go
new file mode 100644
index 0000000..7bb1b6b
--- /dev/null
+++ b/test/alg.go
@@ -0,0 +1,46 @@
+// build
+
+// Copyright 2016 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.
+
+// This file tests that required algs are generated,
+// even when similar types have been marked elsewhere
+// as not needing algs. See CLs 19769 and 19770.
+
+package main
+
+import "fmt"
+
+//go:noinline
+func f(m map[[8]string]int) int {
+ var k [8]string
+ return m[k]
+}
+
+//go:noinline
+func g(m map[[8]interface{}]int) int {
+ var k [8]interface{}
+ return m[k]
+}
+
+//go:noinline
+func h(m map[[2]string]int) int {
+ var k [2]string
+ return m[k]
+}
+
+type T map[string]interface{}
+
+func v(x ...string) string {
+ return x[0] + x[1]
+}
+
+func main() {
+ fmt.Println(
+ f(map[[8]string]int{}),
+ g(map[[8]interface{}]int{}),
+ h(map[[2]string]int{}),
+ v("a", "b"),
+ )
+}
diff --git a/test/alias.go b/test/alias.go
index ec93a2d..aabaef8 100644
--- a/test/alias.go
+++ b/test/alias.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/alias1.go b/test/alias1.go
index 42cf693..5707917 100644
--- a/test/alias1.go
+++ b/test/alias1.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/atomicload.go b/test/atomicload.go
new file mode 100644
index 0000000..76f1ad4
--- /dev/null
+++ b/test/atomicload.go
@@ -0,0 +1,45 @@
+// run
+
+// Copyright 2016 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.
+
+// Check that we do loads exactly once. The SSA backend
+// once tried to do the load in f twice, once sign extended
+// and once zero extended. This can cause problems in
+// racy code, particularly sync/mutex.
+
+package main
+
+func f(p *byte) bool {
+ x := *p
+ a := int64(int8(x))
+ b := int64(uint8(x))
+ return a == b
+}
+
+func main() {
+ var x byte
+ const N = 1000000
+ c := make(chan struct{})
+ go func() {
+ for i := 0; i < N; i++ {
+ x = 1
+ }
+ c <- struct{}{}
+ }()
+ go func() {
+ for i := 0; i < N; i++ {
+ x = 2
+ }
+ c <- struct{}{}
+ }()
+
+ for i := 0; i < N; i++ {
+ if !f(&x) {
+ panic("non-atomic load!")
+ }
+ }
+ <-c
+ <-c
+}
diff --git a/test/bench/garbage/Makefile b/test/bench/garbage/Makefile
index 9883845..c10ef0a 100644
--- a/test/bench/garbage/Makefile
+++ b/test/bench/garbage/Makefile
@@ -1,4 +1,4 @@
-# Copyright 2010 The Go Authors. All rights reserved.
+# Copyright 2010 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.
diff --git a/test/bench/garbage/parser.go b/test/bench/garbage/parser.go
index a685507..817afa9 100644
--- a/test/bench/garbage/parser.go
+++ b/test/bench/garbage/parser.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/bench/garbage/stats.go b/test/bench/garbage/stats.go
index 6dc0aeb..937e00f 100644
--- a/test/bench/garbage/stats.go
+++ b/test/bench/garbage/stats.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/bench/garbage/tree2.go b/test/bench/garbage/tree2.go
index a171c69..a70a106 100644
--- a/test/bench/garbage/tree2.go
+++ b/test/bench/garbage/tree2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/bench/go1/binarytree_test.go b/test/bench/go1/binarytree_test.go
index c64c4b8..e5e49d5 100644
--- a/test/bench/go1/binarytree_test.go
+++ b/test/bench/go1/binarytree_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/go1/fannkuch_test.go b/test/bench/go1/fannkuch_test.go
index ae45bfd..0cf6115 100644
--- a/test/bench/go1/fannkuch_test.go
+++ b/test/bench/go1/fannkuch_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/go1/fasta_test.go b/test/bench/go1/fasta_test.go
index bff056f..99d8c97 100644
--- a/test/bench/go1/fasta_test.go
+++ b/test/bench/go1/fasta_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -14,9 +14,9 @@
var n int = 25e6
if runtime.GOARCH == "arm" {
// TODO(dfc) remove this limitation after precise gc.
- // A value of 25e6 consumes 465mb of heap on 32bit
- // platforms, which is too much for most ARM systems.
- // A value of 25e5 produces a memory layout that
+ // A value of 25e6 consumes 465mb of heap on 32bit
+ // platforms, which is too much for most ARM systems.
+ // A value of 25e5 produces a memory layout that
// confuses the gc on 32bit platforms. So 25e4 it is.
n = 25e4
}
diff --git a/test/bench/go1/gob_test.go b/test/bench/go1/gob_test.go
index b172b80..224beff 100644
--- a/test/bench/go1/gob_test.go
+++ b/test/bench/go1/gob_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/go1/gzip_test.go b/test/bench/go1/gzip_test.go
index fe4c480..648eec5 100644
--- a/test/bench/go1/gzip_test.go
+++ b/test/bench/go1/gzip_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/go1/http_test.go b/test/bench/go1/http_test.go
index 34e789f..7ece9b2 100644
--- a/test/bench/go1/http_test.go
+++ b/test/bench/go1/http_test.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/bench/go1/json_test.go b/test/bench/go1/json_test.go
index 1d42619..5ff1f8b 100644
--- a/test/bench/go1/json_test.go
+++ b/test/bench/go1/json_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/go1/jsondata_test.go b/test/bench/go1/jsondata_test.go
index cf0fac1..281b6ca 100644
--- a/test/bench/go1/jsondata_test.go
+++ b/test/bench/go1/jsondata_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -1816,4 +1816,4 @@
cZ9UZZJyYojLjaeJHfJU1UZUEmBfLumu8yW5skuyE9uh2BmVxJZi6KxaXBNwSolw
BqBcQLj3ucNZIYZLYtirLu3brW6UYgZgZJiDIGiwpsgg7g1AITkgM6FHITxDDnGt
4SDHzZbL5s8fec5PCq5DOzDRdWS+0h5Y2INZak1D29cpVyb2aVrV3Wlt7rQhLa3e
-m3ZwPNcXywE2Qesk1XN24HvZ2Xa6nlm8Pf/xdyRThQkO1NjuAA== `)
+m3ZwPNcXywE2Qesk1XN24HvZ2Xa6nlm8Pf/xdyRThQkO1NjuAA==`)
diff --git a/test/bench/go1/mandel_test.go b/test/bench/go1/mandel_test.go
index 888c5e4..dd543b2 100644
--- a/test/bench/go1/mandel_test.go
+++ b/test/bench/go1/mandel_test.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/bench/go1/parserdata_test.go b/test/bench/go1/parserdata_test.go
index 113e5e3..001c5d8 100644
--- a/test/bench/go1/parserdata_test.go
+++ b/test/bench/go1/parserdata_test.go
@@ -1,10 +1,10 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
// Input for parser benchmark.
// This was generated by starting with a the contents of
-// src/pkg/go/parser/parser.go at rev 9b455eb64690, then
+// src/pkg/go/parser/parser.go at rev 9b455eb64690, then
// compressing with bzip2 -9, then encoding to base64.
// We compile the data into the binary so that the benchmark is
// a stand-alone binary that can be copied easily from machine to
diff --git a/test/bench/go1/revcomp_test.go b/test/bench/go1/revcomp_test.go
index 6b6c1e5..7d57bd6 100644
--- a/test/bench/go1/revcomp_test.go
+++ b/test/bench/go1/revcomp_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/go1/template_test.go b/test/bench/go1/template_test.go
index db4839a..10dacaa 100644
--- a/test/bench/go1/template_test.go
+++ b/test/bench/go1/template_test.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/bench/shootout/binary-tree-freelist.go b/test/bench/shootout/binary-tree-freelist.go
deleted file mode 100644
index 071a4e0..0000000
--- a/test/bench/shootout/binary-tree-freelist.go
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * based on C program by Kevin Carson
- */
-
-package main
-
-import (
- "flag"
- "fmt"
-)
-
-var n = flag.Int("n", 15, "depth")
-
-type Node struct {
- item int
- left, right *Node
-}
-
-type Arena struct {
- head *Node
-}
-
-var arena Arena
-
-func (n *Node) free() {
- if n.left != nil {
- n.left.free()
- }
- if n.right != nil {
- n.right.free()
- }
- n.left = arena.head
- arena.head = n
-}
-
-func (a *Arena) New(item int, left, right *Node) *Node {
- if a.head == nil {
- nodes := make([]Node, 3<<uint(*n))
- for i := 0; i < len(nodes)-1; i++ {
- nodes[i].left = &nodes[i+1]
- }
- a.head = &nodes[0]
- }
- n := a.head
- a.head = a.head.left
- n.item = item
- n.left = left
- n.right = right
- return n
-}
-
-func bottomUpTree(item, depth int) *Node {
- if depth <= 0 {
- return arena.New(item, nil, nil)
- }
- return arena.New(item, bottomUpTree(2*item-1, depth-1), bottomUpTree(2*item, depth-1))
-}
-
-func (n *Node) itemCheck() int {
- if n.left == nil {
- return n.item
- }
- return n.item + n.left.itemCheck() - n.right.itemCheck()
-}
-
-const minDepth = 4
-
-func main() {
- flag.Parse()
-
- maxDepth := *n
- if minDepth+2 > *n {
- maxDepth = minDepth + 2
- }
- stretchDepth := maxDepth + 1
-
- check := bottomUpTree(0, stretchDepth).itemCheck()
- fmt.Printf("stretch tree of depth %d\t check: %d\n", stretchDepth, check)
-
- longLivedTree := bottomUpTree(0, maxDepth)
-
- for depth := minDepth; depth <= maxDepth; depth += 2 {
- iterations := 1 << uint(maxDepth-depth+minDepth)
- check = 0
-
- for i := 1; i <= iterations; i++ {
- t := bottomUpTree(i, depth)
- check += t.itemCheck()
- t.free()
- t = bottomUpTree(-i, depth)
- check += t.itemCheck()
- t.free()
- }
- fmt.Printf("%d\t trees of depth %d\t check: %d\n", iterations*2, depth, check)
- }
- fmt.Printf("long lived tree of depth %d\t check: %d\n", maxDepth, longLivedTree.itemCheck())
-}
diff --git a/test/bench/shootout/binary-tree-freelist.txt b/test/bench/shootout/binary-tree-freelist.txt
deleted file mode 100644
index f8286dd..0000000
--- a/test/bench/shootout/binary-tree-freelist.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-stretch tree of depth 16 check: -1
-65536 trees of depth 4 check: -65536
-16384 trees of depth 6 check: -16384
-4096 trees of depth 8 check: -4096
-1024 trees of depth 10 check: -1024
-256 trees of depth 12 check: -256
-64 trees of depth 14 check: -64
-long lived tree of depth 15 check: -1
diff --git a/test/bench/shootout/binary-tree.c b/test/bench/shootout/binary-tree.c
deleted file mode 100644
index 9c35ac5..0000000
--- a/test/bench/shootout/binary-tree.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Shootout Benchmarks
- http://shootout.alioth.debian.org/
-
- contributed by Kevin Carson
- compilation:
- gcc -O3 -fomit-frame-pointer -funroll-loops -static binary-trees.c -lm
- icc -O3 -ip -unroll -static binary-trees.c -lm
-*/
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-
-typedef struct tn {
- struct tn* left;
- struct tn* right;
- long item;
-} treeNode;
-
-
-treeNode* NewTreeNode(treeNode* left, treeNode* right, long item)
-{
- treeNode* new;
-
- new = (treeNode*)malloc(sizeof(treeNode));
-
- new->left = left;
- new->right = right;
- new->item = item;
-
- return new;
-} /* NewTreeNode() */
-
-
-long ItemCheck(treeNode* tree)
-{
- if (tree->left == NULL)
- return tree->item;
- else
- return tree->item + ItemCheck(tree->left) - ItemCheck(tree->right);
-} /* ItemCheck() */
-
-
-treeNode* BottomUpTree(long item, unsigned depth)
-{
- if (depth > 0)
- return NewTreeNode
- (
- BottomUpTree(2 * item - 1, depth - 1),
- BottomUpTree(2 * item, depth - 1),
- item
- );
- else
- return NewTreeNode(NULL, NULL, item);
-} /* BottomUpTree() */
-
-
-void DeleteTree(treeNode* tree)
-{
- if (tree->left != NULL)
- {
- DeleteTree(tree->left);
- DeleteTree(tree->right);
- }
-
- free(tree);
-} /* DeleteTree() */
-
-
-int main(int argc, char* argv[])
-{
- unsigned N, depth, minDepth, maxDepth, stretchDepth;
- treeNode *stretchTree, *longLivedTree, *tempTree;
-
- N = atol(argv[1]);
-
- minDepth = 4;
-
- if ((minDepth + 2) > N)
- maxDepth = minDepth + 2;
- else
- maxDepth = N;
-
- stretchDepth = maxDepth + 1;
-
- stretchTree = BottomUpTree(0, stretchDepth);
- printf
- (
- "stretch tree of depth %u\t check: %li\n",
- stretchDepth,
- ItemCheck(stretchTree)
- );
-
- DeleteTree(stretchTree);
-
- longLivedTree = BottomUpTree(0, maxDepth);
-
- for (depth = minDepth; depth <= maxDepth; depth += 2)
- {
- long i, iterations, check;
-
- iterations = pow(2, maxDepth - depth + minDepth);
-
- check = 0;
-
- for (i = 1; i <= iterations; i++)
- {
- tempTree = BottomUpTree(i, depth);
- check += ItemCheck(tempTree);
- DeleteTree(tempTree);
-
- tempTree = BottomUpTree(-i, depth);
- check += ItemCheck(tempTree);
- DeleteTree(tempTree);
- } /* for(i = 1...) */
-
- printf
- (
- "%li\t trees of depth %u\t check: %li\n",
- iterations * 2,
- depth,
- check
- );
- } /* for(depth = minDepth...) */
-
- printf
- (
- "long lived tree of depth %u\t check: %li\n",
- maxDepth,
- ItemCheck(longLivedTree)
- );
-
- return 0;
-} /* main() */
diff --git a/test/bench/shootout/binary-tree.go b/test/bench/shootout/binary-tree.go
deleted file mode 100644
index 9f867d1..0000000
--- a/test/bench/shootout/binary-tree.go
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * based on C program by Kevin Carson
- */
-
-package main
-
-import (
- "flag"
- "fmt"
-)
-
-var n = flag.Int("n", 15, "depth")
-
-type Node struct {
- item int
- left, right *Node
-}
-
-func bottomUpTree(item, depth int) *Node {
- if depth <= 0 {
- return &Node{item: item}
- }
- return &Node{item, bottomUpTree(2*item-1, depth-1), bottomUpTree(2*item, depth-1)}
-}
-
-func (n *Node) itemCheck() int {
- if n.left == nil {
- return n.item
- }
- return n.item + n.left.itemCheck() - n.right.itemCheck()
-}
-
-const minDepth = 4
-
-func main() {
- flag.Parse()
-
- maxDepth := *n
- if minDepth+2 > *n {
- maxDepth = minDepth + 2
- }
- stretchDepth := maxDepth + 1
-
- check := bottomUpTree(0, stretchDepth).itemCheck()
- fmt.Printf("stretch tree of depth %d\t check: %d\n", stretchDepth, check)
-
- longLivedTree := bottomUpTree(0, maxDepth)
-
- for depth := minDepth; depth <= maxDepth; depth += 2 {
- iterations := 1 << uint(maxDepth-depth+minDepth)
- check = 0
-
- for i := 1; i <= iterations; i++ {
- check += bottomUpTree(i, depth).itemCheck()
- check += bottomUpTree(-i, depth).itemCheck()
- }
- fmt.Printf("%d\t trees of depth %d\t check: %d\n", iterations*2, depth, check)
- }
- fmt.Printf("long lived tree of depth %d\t check: %d\n", maxDepth, longLivedTree.itemCheck())
-}
diff --git a/test/bench/shootout/binary-tree.txt b/test/bench/shootout/binary-tree.txt
deleted file mode 100644
index f8286dd..0000000
--- a/test/bench/shootout/binary-tree.txt
+++ /dev/null
@@ -1,8 +0,0 @@
-stretch tree of depth 16 check: -1
-65536 trees of depth 4 check: -65536
-16384 trees of depth 6 check: -16384
-4096 trees of depth 8 check: -4096
-1024 trees of depth 10 check: -1024
-256 trees of depth 12 check: -256
-64 trees of depth 14 check: -64
-long lived tree of depth 15 check: -1
diff --git a/test/bench/shootout/chameneosredux.c b/test/bench/shootout/chameneosredux.c
deleted file mode 100644
index ed78c31..0000000
--- a/test/bench/shootout/chameneosredux.c
+++ /dev/null
@@ -1,330 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- http://shootout.alioth.debian.org/
-
- contributed by Michael Barker
- based on a Java contribution by Luzius Meisser
-
- convert to C by dualamd
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <pthread.h>
-
-
-enum Colour
-{
- blue = 0,
- red = 1,
- yellow = 2,
- Invalid = 3
-};
-
-const char* ColourName[] = {"blue", "red", "yellow"};
-const int STACK_SIZE = 32*1024;
-
-typedef unsigned int BOOL;
-const BOOL TRUE = 1;
-const BOOL FALSE = 0;
-
-int CreatureID = 0;
-
-
-enum Colour doCompliment(enum Colour c1, enum Colour c2)
-{
- switch (c1)
- {
- case blue:
- switch (c2)
- {
- case blue:
- return blue;
- case red:
- return yellow;
- case yellow:
- return red;
- default:
- goto errlb;
- }
- case red:
- switch (c2)
- {
- case blue:
- return yellow;
- case red:
- return red;
- case yellow:
- return blue;
- default:
- goto errlb;
- }
- case yellow:
- switch (c2)
- {
- case blue:
- return red;
- case red:
- return blue;
- case yellow:
- return yellow;
- default:
- goto errlb;
- }
- default:
- break;
- }
-
-errlb:
- printf("Invalid colour\n");
- exit( 1 );
-}
-
-/* convert integer to number string: 1234 -> "one two three four" */
-char* formatNumber(int n, char* outbuf)
-{
- int ochar = 0, ichar = 0;
- int i;
- char tmp[64];
-
- const char* NUMBERS[] =
- {
- "zero", "one", "two", "three", "four", "five",
- "six", "seven", "eight", "nine"
- };
-
- ichar = sprintf(tmp, "%d", n);
-
- for (i = 0; i < ichar; i++)
- ochar += sprintf( outbuf + ochar, " %s", NUMBERS[ tmp[i] - '0' ] );
-
- return outbuf;
-}
-
-
-struct MeetingPlace
-{
- pthread_mutex_t mutex;
- int meetingsLeft;
- struct Creature* firstCreature;
-};
-
-struct Creature
-{
- pthread_t ht;
- pthread_attr_t stack_att;
-
- struct MeetingPlace* place;
- int count;
- int sameCount;
-
- enum Colour colour;
- int id;
-
- BOOL two_met;
- BOOL sameid;
-};
-
-
-void MeetingPlace_Init(struct MeetingPlace* m, int meetings )
-{
- pthread_mutex_init( &m->mutex, 0 );
- m->meetingsLeft = meetings;
- m->firstCreature = 0;
-}
-
-
-BOOL Meet( struct Creature* cr)
-{
- BOOL retval = TRUE;
-
- struct MeetingPlace* mp = cr->place;
- pthread_mutex_lock( &(mp->mutex) );
-
- if ( mp->meetingsLeft > 0 )
- {
- if ( mp->firstCreature == 0 )
- {
- cr->two_met = FALSE;
- mp->firstCreature = cr;
- }
- else
- {
- struct Creature* first;
- enum Colour newColour;
-
- first = mp->firstCreature;
- newColour = doCompliment( cr->colour, first->colour );
-
- cr->sameid = cr->id == first->id;
- cr->colour = newColour;
- cr->two_met = TRUE;
-
- first->sameid = cr->sameid;
- first->colour = newColour;
- first->two_met = TRUE;
-
- mp->firstCreature = 0;
- mp->meetingsLeft--;
- }
- }
- else
- retval = FALSE;
-
- pthread_mutex_unlock( &(mp->mutex) );
- return retval;
-}
-
-
-void* CreatureThreadRun(void* param)
-{
- struct Creature* cr = (struct Creature*)param;
-
- while (TRUE)
- {
- if ( Meet(cr) )
- {
- while (cr->two_met == FALSE)
- sched_yield();
-
- if (cr->sameid)
- cr->sameCount++;
- cr->count++;
- }
- else
- break;
- }
-
- return 0;
-}
-
-void Creature_Init( struct Creature *cr, struct MeetingPlace* place, enum Colour colour )
-{
- cr->place = place;
- cr->count = cr->sameCount = 0;
-
- cr->id = ++CreatureID;
- cr->colour = colour;
- cr->two_met = FALSE;
-
- pthread_attr_init( &cr->stack_att );
- pthread_attr_setstacksize( &cr->stack_att, STACK_SIZE );
- pthread_create( &cr->ht, &cr->stack_att, &CreatureThreadRun, (void*)(cr) );
-}
-
-/* format meeting times of each creature to string */
-char* Creature_getResult(struct Creature* cr, char* str)
-{
- char numstr[256];
- formatNumber(cr->sameCount, numstr);
-
- sprintf( str, "%u%s", cr->count, numstr );
- return str;
-}
-
-
-void runGame( int n_meeting, int ncolor, const enum Colour* colours )
-{
- int i;
- int total = 0;
- char str[256];
-
- struct MeetingPlace place;
- struct Creature *creatures = (struct Creature*) calloc( ncolor, sizeof(struct Creature) );
-
- MeetingPlace_Init( &place, n_meeting );
-
- /* print initial color of each creature */
- for (i = 0; i < ncolor; i++)
- {
- printf( "%s ", ColourName[ colours[i] ] );
- Creature_Init( &(creatures[i]), &place, colours[i] );
- }
- printf("\n");
-
- /* wait for them to meet */
- for (i = 0; i < ncolor; i++)
- pthread_join( creatures[i].ht, 0 );
-
- /* print meeting times of each creature */
- for (i = 0; i < ncolor; i++)
- {
- printf( "%s\n", Creature_getResult(&(creatures[i]), str) );
- total += creatures[i].count;
- }
-
- /* print total meeting times, should equal n_meeting */
- printf( "%s\n\n", formatNumber(total, str) );
-
- /* cleaup & quit */
- pthread_mutex_destroy( &place.mutex );
- free( creatures );
-}
-
-
-void printColours( enum Colour c1, enum Colour c2 )
-{
- printf( "%s + %s -> %s\n",
- ColourName[c1],
- ColourName[c2],
- ColourName[doCompliment(c1, c2)] );
-}
-
-void printColoursTable(void)
-{
- printColours(blue, blue);
- printColours(blue, red);
- printColours(blue, yellow);
- printColours(red, blue);
- printColours(red, red);
- printColours(red, yellow);
- printColours(yellow, blue);
- printColours(yellow, red);
- printColours(yellow, yellow);
-}
-
-int main(int argc, char** argv)
-{
- int n = (argc == 2) ? atoi(argv[1]) : 600;
-
- printColoursTable();
- printf("\n");
-
- const enum Colour r1[] = { blue, red, yellow };
- const enum Colour r2[] = { blue, red, yellow,
- red, yellow, blue,
- red, yellow, red, blue };
-
- runGame( n, sizeof(r1) / sizeof(r1[0]), r1 );
- runGame( n, sizeof(r2) / sizeof(r2[0]), r2 );
-
- return 0;
-}
diff --git a/test/bench/shootout/chameneosredux.go b/test/bench/shootout/chameneosredux.go
deleted file mode 100644
index 72ce7dd..0000000
--- a/test/bench/shootout/chameneosredux.go
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "strconv"
-)
-
-const (
- blue = iota
- red
- yellow
- ncol
-)
-
-var complement = [...]int{
- red | red<<2: red,
- red | yellow<<2: blue,
- red | blue<<2: yellow,
- yellow | red<<2: blue,
- yellow | yellow<<2: yellow,
- yellow | blue<<2: red,
- blue | red<<2: yellow,
- blue | yellow<<2: red,
- blue | blue<<2: blue,
-}
-
-var colname = [...]string{
- blue: "blue",
- red: "red",
- yellow: "yellow",
-}
-
-// information about the current state of a creature.
-type info struct {
- colour int // creature's current colour.
- name int // creature's name.
-}
-
-// exclusive access data-structure kept inside meetingplace.
-// if mate is nil, it indicates there's no creature currently waiting;
-// otherwise the creature's info is stored in info, and
-// it is waiting to receive its mate's information on the mate channel.
-type rendez struct {
- n int // current number of encounters.
- mate chan<- info // creature waiting when non-nil.
- info info // info about creature waiting.
-}
-
-// result sent by each creature at the end of processing.
-type result struct {
- met int
- same int
-}
-
-var n = 600
-
-func main() {
- flag.Parse()
- if flag.NArg() > 0 {
- n, _ = strconv.Atoi(flag.Arg(0))
- }
-
- for c0 := 0; c0 < ncol; c0++ {
- for c1 := 0; c1 < ncol; c1++ {
- fmt.Printf("%s + %s -> %s\n", colname[c0], colname[c1], colname[complement[c0|c1<<2]])
- }
- }
- fmt.Print("\n")
-
- pallmall([]int{blue, red, yellow})
- pallmall([]int{blue, red, yellow, red, yellow, blue, red, yellow, red, blue})
-}
-
-func pallmall(cols []int) {
-
- // invariant: meetingplace always contains a value unless a creature
- // is currently dealing with it (whereupon it must put it back).
- meetingplace := make(chan rendez, 1)
- meetingplace <- rendez{n: 0}
-
- ended := make(chan result)
- msg := ""
- for i, col := range cols {
- go creature(info{col, i}, meetingplace, ended)
- msg += " " + colname[col]
- }
- fmt.Println(msg)
- tot := 0
- // wait for all results
- for range cols {
- result := <-ended
- tot += result.met
- fmt.Printf("%v%v\n", result.met, spell(result.same, true))
- }
- fmt.Printf("%v\n\n", spell(tot, true))
-}
-
-// in this function, variables ending in 0 refer to the local creature,
-// variables ending in 1 to the creature we've met.
-func creature(info0 info, meetingplace chan rendez, ended chan result) {
- c0 := make(chan info)
- met := 0
- same := 0
- for {
- var othername int
- // get access to rendez data and decide what to do.
- switch r := <-meetingplace; {
- case r.n >= n:
- // if no more meetings left, then send our result data and exit.
- meetingplace <- rendez{n: r.n}
- ended <- result{met, same}
- return
- case r.mate == nil:
- // no creature waiting; wait for someone to meet us,
- // get their info and send our info in reply.
- meetingplace <- rendez{n: r.n, info: info0, mate: c0}
- info1 := <-c0
- othername = info1.name
- info0.colour = complement[info0.colour|info1.colour<<2]
- default:
- // another creature is waiting for us with its info;
- // increment meeting count,
- // send them our info in reply.
- r.n++
- meetingplace <- rendez{n: r.n, mate: nil}
- r.mate <- info0
- othername = r.info.name
- info0.colour = complement[info0.colour|r.info.colour<<2]
- }
- if othername == info0.name {
- same++
- }
- met++
- }
-}
-
-var digits = [...]string{"zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"}
-
-func spell(n int, required bool) string {
- if n == 0 && !required {
- return ""
- }
- return spell(n/10, false) + " " + digits[n%10]
-}
diff --git a/test/bench/shootout/chameneosredux.txt b/test/bench/shootout/chameneosredux.txt
deleted file mode 100644
index 6016d59..0000000
--- a/test/bench/shootout/chameneosredux.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-blue + blue -> blue
-blue + red -> yellow
-blue + yellow -> red
-red + blue -> yellow
-red + red -> red
-red + yellow -> blue
-yellow + blue -> red
-yellow + red -> blue
-yellow + yellow -> yellow
-
- blue red yellow
-400 zero
-400 zero
-400 zero
- one two zero zero
-
- blue red yellow red yellow blue red yellow red blue
-120 zero
-120 zero
-120 zero
-120 zero
-120 zero
-120 zero
-120 zero
-120 zero
-120 zero
-120 zero
- one two zero zero
-
diff --git a/test/bench/shootout/fannkuch-parallel.go b/test/bench/shootout/fannkuch-parallel.go
deleted file mode 100644
index 7e9b98d..0000000
--- a/test/bench/shootout/fannkuch-parallel.go
+++ /dev/null
@@ -1,224 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * Based on fannkuch.scala by Rex Kerr
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "runtime"
-)
-
-var n = flag.Int("n", 7, "count")
-var nCPU = flag.Int("ncpu", 4, "number of cpus")
-
-type Job struct {
- start []int
- n int
-}
-
-type Found struct {
- who *Kucher
- k int
-}
-
-type Kucher struct {
- perm []int
- temp []int
- flip []int
- in chan Job
-}
-
-func NewKucher(length int) *Kucher {
- return &Kucher{
- perm: make([]int, length),
- temp: make([]int, length),
- flip: make([]int, length),
- in: make(chan Job),
- }
-}
-
-func (k *Kucher) permute(n int) bool {
- i := 0
- for ; i < n-1 && k.flip[i] == 0; i++ {
- t := k.perm[0]
- j := 0
- for ; j <= i; j++ {
- k.perm[j] = k.perm[j+1]
- }
- k.perm[j] = t
- }
- k.flip[i]--
- for i > 0 {
- i--
- k.flip[i] = i
- }
- return k.flip[n-1] >= 0
-}
-
-func (k *Kucher) count() int {
- K := 0
- copy(k.temp, k.perm)
- for k.temp[0] != 0 {
- m := k.temp[0]
- for i := 0; i < m; i++ {
- k.temp[i], k.temp[m] = k.temp[m], k.temp[i]
- m--
- }
- K++
- }
- return K
-}
-
-func (k *Kucher) Run(foreman chan<- Found) {
- for job := range k.in {
- verbose := 30
- copy(k.perm, job.start)
- for i, v := range k.perm {
- if v != i {
- verbose = 0
- }
- k.flip[i] = i
- }
- K := 0
- for {
- if verbose > 0 {
- for _, p := range k.perm {
- fmt.Print(p + 1)
- }
- fmt.Println()
- verbose--
- }
- count := k.count()
- if count > K {
- K = count
- }
- if !k.permute(job.n) {
- break
- }
- }
- foreman <- Found{k, K}
- }
-}
-
-type Fanner struct {
- jobind int
- jobsdone int
- k int
- jobs []Job
- workers []*Kucher
- in chan Found
- result chan int
-}
-
-func NewFanner(jobs []Job, workers []*Kucher) *Fanner {
- return &Fanner{
- jobs: jobs, workers: workers,
- in: make(chan Found),
- result: make(chan int),
- }
-}
-
-func (f *Fanner) Run(N int) {
- for msg := range f.in {
- if msg.k > f.k {
- f.k = msg.k
- }
- if msg.k >= 0 {
- f.jobsdone++
- }
- if f.jobind < len(f.jobs) {
- msg.who.in <- f.jobs[f.jobind]
- f.jobind++
- } else if f.jobsdone == len(f.jobs) {
- f.result <- f.k
- return
- }
- }
-}
-
-func swapped(a []int, i, j int) []int {
- b := make([]int, len(a))
- copy(b, a)
- b[i], b[j] = a[j], a[i]
- return b
-}
-
-func main() {
- flag.Parse()
- runtime.GOMAXPROCS(*nCPU)
- N := *n
- base := make([]int, N)
- for i := range base {
- base[i] = i
- }
-
- njobs := 1
- if N > 8 {
- njobs += (N*(N-1))/2 - 28 // njobs = 1 + sum(8..N-1) = 1 + sum(1..N-1) - sum(1..7)
- }
- jobs := make([]Job, njobs)
- jobsind := 0
-
- firstN := N
- if firstN > 8 {
- firstN = 8
- }
- jobs[jobsind] = Job{base, firstN}
- jobsind++
- for i := N - 1; i >= 8; i-- {
- for j := 0; j < i; j++ {
- jobs[jobsind] = Job{swapped(base, i, j), i}
- jobsind++
- }
- }
-
- nworkers := *nCPU
- if njobs < nworkers {
- nworkers = njobs
- }
- workers := make([]*Kucher, nworkers)
- foreman := NewFanner(jobs, workers)
- go foreman.Run(N)
- for i := range workers {
- k := NewKucher(N)
- workers[i] = k
- go k.Run(foreman.in)
- foreman.in <- Found{k, -1}
- }
- fmt.Printf("Pfannkuchen(%d) = %d\n", N, <-foreman.result)
-}
diff --git a/test/bench/shootout/fannkuch-parallel.txt b/test/bench/shootout/fannkuch-parallel.txt
deleted file mode 100644
index e66f779..0000000
--- a/test/bench/shootout/fannkuch-parallel.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-1234567
-2134567
-2314567
-3214567
-3124567
-1324567
-2341567
-3241567
-3421567
-4321567
-4231567
-2431567
-3412567
-4312567
-4132567
-1432567
-1342567
-3142567
-4123567
-1423567
-1243567
-2143567
-2413567
-4213567
-2345167
-3245167
-3425167
-4325167
-4235167
-2435167
-Pfannkuchen(7) = 16
diff --git a/test/bench/shootout/fannkuch.c b/test/bench/shootout/fannkuch.c
deleted file mode 100644
index e576b54..0000000
--- a/test/bench/shootout/fannkuch.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * The Computer Language Shootout
- * http://shootout.alioth.debian.org/
- * Contributed by Heiner Marxen
- *
- * "fannkuch" for C gcc
- *
- * $Id: fannkuch.1.gcc.code,v 1.15 2009-04-28 15:39:31 igouy-guest Exp $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#define Int int
-#define Aint int
-
- static long
-fannkuch( int n )
-{
- Aint* perm;
- Aint* perm1;
- Aint* count;
- long flips;
- long flipsMax;
- Int r;
- Int i;
- Int k;
- Int didpr;
- const Int n1 = n - 1;
-
- if( n < 1 ) return 0;
-
- perm = calloc(n, sizeof(*perm ));
- perm1 = calloc(n, sizeof(*perm1));
- count = calloc(n, sizeof(*count));
-
- for( i=0 ; i<n ; ++i ) perm1[i] = i; /* initial (trivial) permu */
-
- r = n; didpr = 0; flipsMax = 0;
- for(;;) {
- if( didpr < 30 ) {
- for( i=0 ; i<n ; ++i ) printf("%d", (int)(1+perm1[i]));
- printf("\n");
- ++didpr;
- }
- for( ; r!=1 ; --r ) {
- count[r-1] = r;
- }
-
-#define XCH(x,y) { Aint t_mp; t_mp=(x); (x)=(y); (y)=t_mp; }
-
- if( ! (perm1[0]==0 || perm1[n1]==n1) ) {
- flips = 0;
- for( i=1 ; i<n ; ++i ) { /* perm = perm1 */
- perm[i] = perm1[i];
- }
- k = perm1[0]; /* cache perm[0] in k */
- do { /* k!=0 ==> k>0 */
- Int j;
- for( i=1, j=k-1 ; i<j ; ++i, --j ) {
- XCH(perm[i], perm[j])
- }
- ++flips;
- /*
- * Now exchange k (caching perm[0]) and perm[k]... with care!
- * XCH(k, perm[k]) does NOT work!
- */
- j=perm[k]; perm[k]=k ; k=j;
- }while( k );
- if( flipsMax < flips ) {
- flipsMax = flips;
- }
- }
-
- for(;;) {
- if( r == n ) {
- return flipsMax;
- }
- /* rotate down perm[0..r] by one */
- {
- Int perm0 = perm1[0];
- i = 0;
- while( i < r ) {
- k = i+1;
- perm1[i] = perm1[k];
- i = k;
- }
- perm1[r] = perm0;
- }
- if( (count[r] -= 1) > 0 ) {
- break;
- }
- ++r;
- }
- }
-}
-
- int
-main( int argc, char* argv[] )
-{
- int n = (argc>1) ? atoi(argv[1]) : 0;
-
- printf("Pfannkuchen(%d) = %ld\n", n, fannkuch(n));
- return 0;
-}
diff --git a/test/bench/shootout/fannkuch.go b/test/bench/shootout/fannkuch.go
deleted file mode 100644
index b554c77..0000000
--- a/test/bench/shootout/fannkuch.go
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * Based on fannkuch.c by Heiner Marxen
- */
-
-package main
-
-import (
- "flag"
- "fmt"
-)
-
-var n = flag.Int("n", 7, "count")
-
-func fannkuch(n int) int {
- if n < 1 {
- return 0
- }
-
- n1 := n - 1
- perm := make([]int, n)
- perm1 := make([]int, n)
- count := make([]int, n)
-
- for i := 0; i < n; i++ {
- perm1[i] = i // initial (trivial) permutation
- }
-
- r := n
- didpr := 0
- flipsMax := 0
- for {
- if didpr < 30 {
- for i := 0; i < n; i++ {
- fmt.Printf("%d", 1+perm1[i])
- }
- fmt.Printf("\n")
- didpr++
- }
- for ; r != 1; r-- {
- count[r-1] = r
- }
-
- if perm1[0] != 0 && perm1[n1] != n1 {
- flips := 0
- for i := 1; i < n; i++ { // perm = perm1
- perm[i] = perm1[i]
- }
- k := perm1[0] // cache perm[0] in k
- for { // k!=0 ==> k>0
- for i, j := 1, k-1; i < j; i, j = i+1, j-1 {
- perm[i], perm[j] = perm[j], perm[i]
- }
- flips++
- // Now exchange k (caching perm[0]) and perm[k]... with care!
- j := perm[k]
- perm[k] = k
- k = j
- if k == 0 {
- break
- }
- }
- if flipsMax < flips {
- flipsMax = flips
- }
- }
-
- for ; r < n; r++ {
- // rotate down perm[0..r] by one
- perm0 := perm1[0]
- for i := 0; i < r; i++ {
- perm1[i] = perm1[i+1]
- }
- perm1[r] = perm0
- count[r]--
- if count[r] > 0 {
- break
- }
- }
- if r == n {
- return flipsMax
- }
- }
- return 0
-}
-
-func main() {
- flag.Parse()
- fmt.Printf("Pfannkuchen(%d) = %d\n", *n, fannkuch(*n))
-}
diff --git a/test/bench/shootout/fannkuch.txt b/test/bench/shootout/fannkuch.txt
deleted file mode 100644
index e66f779..0000000
--- a/test/bench/shootout/fannkuch.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-1234567
-2134567
-2314567
-3214567
-3124567
-1324567
-2341567
-3241567
-3421567
-4321567
-4231567
-2431567
-3412567
-4312567
-4132567
-1432567
-1342567
-3142567
-4123567
-1423567
-1243567
-2143567
-2413567
-4213567
-2345167
-3245167
-3425167
-4325167
-4235167
-2435167
-Pfannkuchen(7) = 16
diff --git a/test/bench/shootout/fasta-1000.txt b/test/bench/shootout/fasta-1000.txt
deleted file mode 100644
index f1caba0..0000000
--- a/test/bench/shootout/fasta-1000.txt
+++ /dev/null
@@ -1,171 +0,0 @@
->ONE Homo sapiens alu
-GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
-TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
-AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
-GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
-CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
-GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
-GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
-TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
-AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
-GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
-AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
-AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
-GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
-CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
-AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
-TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
-TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
-GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
-TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
-CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
-CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
-TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
-CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
-AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
-GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
-TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
-TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
-GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
-GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
-ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
-TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
-CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
-CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
-GGCGACAGAGCGAGACTCCG
->TWO IUB ambiguity codes
-cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg
-tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa
-NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt
-cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga
-gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa
-HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca
-tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt
-tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt
-acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct
-tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt
-gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa
-accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt
-RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt
-tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag
-cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg
-ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat
-actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg
-YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa
-KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata
-aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa
-aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg
-gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc
-tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK
-tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt
-ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg
-ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa
-BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt
-aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc
-tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc
-cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac
-aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga
-tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga
-aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD
-gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg
-ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV
-taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa
-ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat
-gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg
-gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa
-tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt
-tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt
-taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca
-cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag
-aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt
-cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt
-ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW
-attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag
-ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa
-attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc
-tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta
->THREE Homo sapiens frequency
-aacacttcaccaggtatcgtgaaggctcaagattacccagagaacctttgcaatataaga
-atatgtatgcagcattaccctaagtaattatattctttttctgactcaaagtgacaagcc
-ctagtgtatattaaatcggtatatttgggaaattcctcaaactatcctaatcaggtagcc
-atgaaagtgatcaaaaaagttcgtacttataccatacatgaattctggccaagtaaaaaa
-tagattgcgcaaaattcgtaccttaagtctctcgccaagatattaggatcctattactca
-tatcgtgtttttctttattgccgccatccccggagtatctcacccatccttctcttaaag
-gcctaatattacctatgcaaataaacatatattgttgaaaattgagaacctgatcgtgat
-tcttatgtgtaccatatgtatagtaatcacgcgactatatagtgctttagtatcgcccgt
-gggtgagtgaatattctgggctagcgtgagatagtttcttgtcctaatatttttcagatc
-gaatagcttctatttttgtgtttattgacatatgtcgaaactccttactcagtgaaagtc
-atgaccagatccacgaacaatcttcggaatcagtctcgttttacggcggaatcttgagtc
-taacttatatcccgtcgcttactttctaacaccccttatgtatttttaaaattacgttta
-ttcgaacgtacttggcggaagcgttattttttgaagtaagttacattgggcagactcttg
-acattttcgatacgactttctttcatccatcacaggactcgttcgtattgatatcagaag
-ctcgtgatgattagttgtcttctttaccaatactttgaggcctattctgcgaaatttttg
-ttgccctgcgaacttcacataccaaggaacacctcgcaacatgccttcatatccatcgtt
-cattgtaattcttacacaatgaatcctaagtaattacatccctgcgtaaaagatggtagg
-ggcactgaggatatattaccaagcatttagttatgagtaatcagcaatgtttcttgtatt
-aagttctctaaaatagttacatcgtaatgttatctcgggttccgcgaataaacgagatag
-attcattatatatggccctaagcaaaaacctcctcgtattctgttggtaattagaatcac
-acaatacgggttgagatattaattatttgtagtacgaagagatataaaaagatgaacaat
-tactcaagtcaagatgtatacgggatttataataaaaatcgggtagagatctgctttgca
-attcagacgtgccactaaatcgtaatatgtcgcgttacatcagaaagggtaactattatt
-aattaataaagggcttaatcactacatattagatcttatccgatagtcttatctattcgt
-tgtatttttaagcggttctaattcagtcattatatcagtgctccgagttctttattattg
-ttttaaggatgacaaaatgcctcttgttataacgctgggagaagcagactaagagtcgga
-gcagttggtagaatgaggctgcaaaagacggtctcgacgaatggacagactttactaaac
-caatgaaagacagaagtagagcaaagtctgaagtggtatcagcttaattatgacaaccct
-taatacttccctttcgccgaatactggcgtggaaaggttttaaaagtcgaagtagttaga
-ggcatctctcgctcataaataggtagactactcgcaatccaatgtgactatgtaatactg
-ggaacatcagtccgcgatgcagcgtgtttatcaaccgtccccactcgcctggggagacat
-gagaccacccccgtggggattattagtccgcagtaatcgactcttgacaatccttttcga
-ttatgtcatagcaatttacgacagttcagcgaagtgactactcggcgaaatggtattact
-aaagcattcgaacccacatgaatgtgattcttggcaatttctaatccactaaagcttttc
-cgttgaatctggttgtagatatttatataagttcactaattaagatcacggtagtatatt
-gatagtgatgtctttgcaagaggttggccgaggaatttacggattctctattgatacaat
-ttgtctggcttataactcttaaggctgaaccaggcgtttttagacgacttgatcagctgt
-tagaatggtttggactccctctttcatgtcagtaacatttcagccgttattgttacgata
-tgcttgaacaatattgatctaccacacacccatagtatattttataggtcatgctgttac
-ctacgagcatggtattccacttcccattcaatgagtattcaacatcactagcctcagaga
-tgatgacccacctctaataacgtcacgttgcggccatgtgaaacctgaacttgagtagac
-gatatcaagcgctttaaattgcatataacatttgagggtaaagctaagcggatgctttat
-ataatcaatactcaataataagatttgattgcattttagagttatgacacgacatagttc
-actaacgagttactattcccagatctagactgaagtactgatcgagacgatccttacgtc
-gatgatcgttagttatcgacttaggtcgggtctctagcggtattggtacttaaccggaca
-ctatactaataacccatgatcaaagcataacagaatacagacgataatttcgccaacata
-tatgtacagaccccaagcatgagaagctcattgaaagctatcattgaagtcccgctcaca
-atgtgtcttttccagacggtttaactggttcccgggagtcctggagtttcgacttacata
-aatggaaacaatgtattttgctaatttatctatagcgtcatttggaccaatacagaatat
-tatgttgcctagtaatccactataacccgcaagtgctgatagaaaatttttagacgattt
-ataaatgccccaagtatccctcccgtgaatcctccgttatactaattagtattcgttcat
-acgtataccgcgcatatatgaacatttggcgataaggcgcgtgaattgttacgtgacaga
-gatagcagtttcttgtgatatggttaacagacgtacatgaagggaaactttatatctata
-gtgatgcttccgtagaaataccgccactggtctgccaatgatgaagtatgtagctttagg
-tttgtactatgaggctttcgtttgtttgcagagtataacagttgcgagtgaaaaaccgac
-gaatttatactaatacgctttcactattggctacaaaatagggaagagtttcaatcatga
-gagggagtatatggatgctttgtagctaaaggtagaacgtatgtatatgctgccgttcat
-tcttgaaagatacataagcgataagttacgacaattataagcaacatccctaccttcgta
-acgatttcactgttactgcgcttgaaatacactatggggctattggcggagagaagcaga
-tcgcgccgagcatatacgagacctataatgttgatgatagagaaggcgtctgaattgata
-catcgaagtacactttctttcgtagtatctctcgtcctctttctatctccggacacaaga
-attaagttatatatatagagtcttaccaatcatgttgaatcctgattctcagagttcttt
-ggcgggccttgtgatgactgagaaacaatgcaatattgctccaaatttcctaagcaaatt
-ctcggttatgttatgttatcagcaaagcgttacgttatgttatttaaatctggaatgacg
-gagcgaagttcttatgtcggtgtgggaataattcttttgaagacagcactccttaaataa
-tatcgctccgtgtttgtatttatcgaatgggtctgtaaccttgcacaagcaaatcggtgg
-tgtatatatcggataacaattaatacgatgttcatagtgacagtatactgatcgagtcct
-ctaaagtcaattacctcacttaacaatctcattgatgttgtgtcattcccggtatcgccc
-gtagtatgtgctctgattgaccgagtgtgaaccaaggaacatctactaatgcctttgtta
-ggtaagatctctctgaattccttcgtgccaacttaaaacattatcaaaatttcttctact
-tggattaactacttttacgagcatggcaaattcccctgtggaagacggttcattattatc
-ggaaaccttatagaaattgcgtgttgactgaaattagatttttattgtaagagttgcatc
-tttgcgattcctctggtctagcttccaatgaacagtcctcccttctattcgacatcgggt
-ccttcgtacatgtctttgcgatgtaataattaggttcggagtgtggccttaatgggtgca
-actaggaatacaacgcaaatttgctgacatgatagcaaatcggtatgccggcaccaaaac
-gtgctccttgcttagcttgtgaatgagactcagtagttaaataaatccatatctgcaatc
-gattccacaggtattgtccactatctttgaactactctaagagatacaagcttagctgag
-accgaggtgtatatgactacgctgatatctgtaaggtaccaatgcaggcaaagtatgcga
-gaagctaataccggctgtttccagctttataagattaaaatttggctgtcctggcggcct
-cagaattgttctatcgtaatcagttggttcattaattagctaagtacgaggtacaactta
-tctgtcccagaacagctccacaagtttttttacagccgaaacccctgtgtgaatcttaat
-atccaagcgcgttatctgattagagtttacaactcagtattttatcagtacgttttgttt
-ccaacattacccggtatgacaaaatgacgccacgtgtcgaataatggtctgaccaatgta
-ggaagtgaaaagataaatat
diff --git a/test/bench/shootout/fasta.c b/test/bench/shootout/fasta.c
deleted file mode 100644
index 64c1c52..0000000
--- a/test/bench/shootout/fasta.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * http://shootout.alioth.debian.org/u32/program.php?test=fasta&lang=gcc&id=3
- */
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by Petr Prokhorenkov
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#ifndef fwrite_unlocked
-// not available on OS X
-#define fwrite_unlocked fwrite
-#define fputc_unlocked fputc
-#define fputs_unlocked fputs
-#endif
-
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
-#define unlikely(x) __builtin_expect((x), 0)
-
-#define IM 139968
-#define IA 3877
-#define IC 29573
-
-#define LINE_LEN 60
-#define LOOKUP_SIZE 4096
-#define LOOKUP_SCALE ((float)(LOOKUP_SIZE - 1))
-
-typedef unsigned random_t;
-
-void
-random_init(random_t *random) {
- *random = 42;
-}
-
-// Special version with result rescaled to LOOKUP_SCALE.
-static inline
-float
-random_next_lookup(random_t *random) {
- *random = (*random*IA + IC)%IM;
-
- return (*random)*(LOOKUP_SCALE/IM);
-}
-
-struct amino_acid {
- char sym;
- float prob;
- float cprob_lookup;
-};
-
-void
-repeat(const char *alu, const char *title, int n) {
- int len = strlen(alu);
- char buffer[len + LINE_LEN];
- int pos = 0;
-
- memcpy(buffer, alu, len);
- memcpy(buffer + len, alu, LINE_LEN);
-
- fputs_unlocked(title, stdout);
- while (n > 0) {
- int bytes = n > LINE_LEN ? LINE_LEN : n;
-
- fwrite_unlocked(buffer + pos, bytes, 1, stdout);
- pos += bytes;
- if (pos > len) {
- pos -= len;
- }
- fputc_unlocked('\n', stdout);
- n -= bytes;
- }
-}
-
-/*
- * Lookup table contains mapping from real values to cumulative
- * probabilities. Careful selection of table size allows lookup
- * virtually in constant time.
- *
- * All cumulative probabilities are rescaled to LOOKUP_SCALE,
- * this allows to save one multiplication operation on each iteration
- * in randomize().
- */
-
-void *
-fill_lookup(struct amino_acid **lookup, struct amino_acid *amino_acid, int amino_acid_size) {
- float p = 0;
- int i, j;
-
- for (i = 0; i < amino_acid_size; i++) {
- p += amino_acid[i].prob;
- amino_acid[i].cprob_lookup = p*LOOKUP_SCALE;
- }
-
- // Prevent rounding error.
- amino_acid[amino_acid_size - 1].cprob_lookup = LOOKUP_SIZE - 1;
-
- for (i = 0, j = 0; i < LOOKUP_SIZE; i++) {
- while (amino_acid[j].cprob_lookup < i) {
- j++;
- }
- lookup[i] = &amino_acid[j];
- }
-
- return 0;
-}
-
-void
-randomize(struct amino_acid *amino_acid, int amino_acid_size,
- const char *title, int n, random_t *rand) {
- struct amino_acid *lookup[LOOKUP_SIZE];
- char line_buffer[LINE_LEN + 1];
- int i, j;
-
- line_buffer[LINE_LEN] = '\n';
-
- fill_lookup(lookup, amino_acid, amino_acid_size);
-
- fputs_unlocked(title, stdout);
-
- for (i = 0, j = 0; i < n; i++, j++) {
- if (j == LINE_LEN) {
- fwrite_unlocked(line_buffer, LINE_LEN + 1, 1, stdout);
- j = 0;
- }
-
- float r = random_next_lookup(rand);
- struct amino_acid *u = lookup[(short)r];
- while (unlikely(u->cprob_lookup < r)) {
- ++u;
- }
- line_buffer[j] = u->sym;
- }
- line_buffer[j] = '\n';
- fwrite_unlocked(line_buffer, j + 1, 1, stdout);
-}
-
-struct amino_acid amino_acid[] = {
- { 'a', 0.27 },
- { 'c', 0.12 },
- { 'g', 0.12 },
- { 't', 0.27 },
-
- { 'B', 0.02 },
- { 'D', 0.02 },
- { 'H', 0.02 },
- { 'K', 0.02 },
- { 'M', 0.02 },
- { 'N', 0.02 },
- { 'R', 0.02 },
- { 'S', 0.02 },
- { 'V', 0.02 },
- { 'W', 0.02 },
- { 'Y', 0.02 },
-};
-
-struct amino_acid homo_sapiens[] = {
- { 'a', 0.3029549426680 },
- { 'c', 0.1979883004921 },
- { 'g', 0.1975473066391 },
- { 't', 0.3015094502008 },
-};
-
-static const char alu[] =
- "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTG"
- "GGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGA"
- "GACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAA"
- "AATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAAT"
- "CCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAAC"
- "CCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTG"
- "CACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA";
-
-int
-main(int argc, const char **argv) {
- int n = argc > 1 ? atoi( argv[1] ) : 512;
- random_t rand;
-
- random_init(&rand);
-
- repeat(alu, ">ONE Homo sapiens alu\n", n*2);
- randomize(amino_acid, ARRAY_SIZE(amino_acid),
- ">TWO IUB ambiguity codes\n", n*3, &rand);
- randomize(homo_sapiens, ARRAY_SIZE(homo_sapiens),
- ">THREE Homo sapiens frequency\n", n*5, &rand);
-
- return 0;
-}
diff --git a/test/bench/shootout/fasta.go b/test/bench/shootout/fasta.go
deleted file mode 100644
index 17ff5da..0000000
--- a/test/bench/shootout/fasta.go
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * Based on C program by by Petr Prokhorenkov.
- */
-
-package main
-
-import (
- "flag"
- "os"
-)
-
-var out = make(buffer, 0, 32768)
-
-var n = flag.Int("n", 1000, "length of result")
-
-const Line = 60
-
-func Repeat(alu []byte, n int) {
- buf := append(alu, alu...)
- off := 0
- for n > 0 {
- m := n
- if m > Line {
- m = Line
- }
- buf1 := out.NextWrite(m + 1)
- copy(buf1, buf[off:])
- buf1[m] = '\n'
- if off += m; off >= len(alu) {
- off -= len(alu)
- }
- n -= m
- }
-}
-
-const (
- IM = 139968
- IA = 3877
- IC = 29573
-
- LookupSize = 4096
- LookupScale float64 = LookupSize - 1
-)
-
-var rand uint32 = 42
-
-type Acid struct {
- sym byte
- prob float64
- cprob float64
- next *Acid
-}
-
-func computeLookup(acid []Acid) *[LookupSize]*Acid {
- var lookup [LookupSize]*Acid
- var p float64
- for i := range acid {
- p += acid[i].prob
- acid[i].cprob = p * LookupScale
- if i > 0 {
- acid[i-1].next = &acid[i]
- }
- }
- acid[len(acid)-1].cprob = 1.0 * LookupScale
-
- j := 0
- for i := range lookup {
- for acid[j].cprob < float64(i) {
- j++
- }
- lookup[i] = &acid[j]
- }
-
- return &lookup
-}
-
-func Random(acid []Acid, n int) {
- lookup := computeLookup(acid)
- for n > 0 {
- m := n
- if m > Line {
- m = Line
- }
- buf := out.NextWrite(m + 1)
- f := LookupScale / IM
- myrand := rand
- for i := 0; i < m; i++ {
- myrand = (myrand*IA + IC) % IM
- r := float64(int(myrand)) * f
- a := lookup[int(r)]
- for a.cprob < r {
- a = a.next
- }
- buf[i] = a.sym
- }
- rand = myrand
- buf[m] = '\n'
- n -= m
- }
-}
-
-func main() {
- defer out.Flush()
-
- flag.Parse()
-
- iub := []Acid{
- {prob: 0.27, sym: 'a'},
- {prob: 0.12, sym: 'c'},
- {prob: 0.12, sym: 'g'},
- {prob: 0.27, sym: 't'},
- {prob: 0.02, sym: 'B'},
- {prob: 0.02, sym: 'D'},
- {prob: 0.02, sym: 'H'},
- {prob: 0.02, sym: 'K'},
- {prob: 0.02, sym: 'M'},
- {prob: 0.02, sym: 'N'},
- {prob: 0.02, sym: 'R'},
- {prob: 0.02, sym: 'S'},
- {prob: 0.02, sym: 'V'},
- {prob: 0.02, sym: 'W'},
- {prob: 0.02, sym: 'Y'},
- }
-
- homosapiens := []Acid{
- {prob: 0.3029549426680, sym: 'a'},
- {prob: 0.1979883004921, sym: 'c'},
- {prob: 0.1975473066391, sym: 'g'},
- {prob: 0.3015094502008, sym: 't'},
- }
-
- alu := []byte(
- "GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGG" +
- "GAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGA" +
- "CCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAAT" +
- "ACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCA" +
- "GCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGG" +
- "AGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCC" +
- "AGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAA")
-
- out.WriteString(">ONE Homo sapiens alu\n")
- Repeat(alu, 2**n)
- out.WriteString(">TWO IUB ambiguity codes\n")
- Random(iub, 3**n)
- out.WriteString(">THREE Homo sapiens frequency\n")
- Random(homosapiens, 5**n)
-}
-
-type buffer []byte
-
-func (b *buffer) Flush() {
- p := *b
- if len(p) > 0 {
- os.Stdout.Write(p)
- }
- *b = p[0:0]
-}
-
-func (b *buffer) WriteString(s string) {
- p := b.NextWrite(len(s))
- copy(p, s)
-}
-
-func (b *buffer) NextWrite(n int) []byte {
- p := *b
- if len(p)+n > cap(p) {
- b.Flush()
- p = *b
- }
- out := p[len(p) : len(p)+n]
- *b = p[:len(p)+n]
- return out
-}
diff --git a/test/bench/shootout/fasta.txt b/test/bench/shootout/fasta.txt
deleted file mode 100644
index f1caba0..0000000
--- a/test/bench/shootout/fasta.txt
+++ /dev/null
@@ -1,171 +0,0 @@
->ONE Homo sapiens alu
-GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA
-TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACT
-AAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAG
-GCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCG
-CCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGT
-GGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCA
-GGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAA
-TTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAG
-AATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCA
-GCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGT
-AATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACC
-AGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTG
-GTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACC
-CGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAG
-AGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTT
-TGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACA
-TGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCT
-GTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGG
-TTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGT
-CTCAAAAAGGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGG
-CGGGCGGATCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCG
-TCTCTACTAAAAATACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTA
-CTCGGGAGGCTGAGGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCG
-AGATCGCGCCACTGCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCG
-GGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACC
-TGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAA
-TACAAAAATTAGCCGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGA
-GGCAGGAGAATCGCTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACT
-GCACTCCAGCCTGGGCGACAGAGCGAGACTCCGTCTCAAAAAGGCCGGGCGCGGTGGCTC
-ACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGATCACCTGAGGTCAGGAGT
-TCGAGACCAGCCTGGCCAACATGGTGAAACCCCGTCTCTACTAAAAATACAAAAATTAGC
-CGGGCGTGGTGGCGCGCGCCTGTAATCCCAGCTACTCGGGAGGCTGAGGCAGGAGAATCG
-CTTGAACCCGGGAGGCGGAGGTTGCAGTGAGCCGAGATCGCGCCACTGCACTCCAGCCTG
-GGCGACAGAGCGAGACTCCG
->TWO IUB ambiguity codes
-cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg
-tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa
-NtactMcSMtYtcMgRtacttctWBacgaaatatagScDtttgaagacacatagtVgYgt
-cattHWtMMWcStgttaggKtSgaYaaccWStcgBttgcgaMttBYatcWtgacaYcaga
-gtaBDtRacttttcWatMttDBcatWtatcttactaBgaYtcttgttttttttYaaScYa
-HgtgttNtSatcMtcVaaaStccRcctDaataataStcYtRDSaMtDttgttSagtRRca
-tttHatSttMtWgtcgtatSSagactYaaattcaMtWatttaSgYttaRgKaRtccactt
-tattRggaMcDaWaWagttttgacatgttctacaaaRaatataataaMttcgDacgaSSt
-acaStYRctVaNMtMgtaggcKatcttttattaaaaagVWaHKYagtttttatttaacct
-tacgtVtcVaattVMBcttaMtttaStgacttagattWWacVtgWYagWVRctDattBYt
-gtttaagaagattattgacVatMaacattVctgtBSgaVtgWWggaKHaatKWcBScSWa
-accRVacacaaactaccScattRatatKVtactatatttHttaagtttSKtRtacaaagt
-RDttcaaaaWgcacatWaDgtDKacgaacaattacaRNWaatHtttStgttattaaMtgt
-tgDcgtMgcatBtgcttcgcgaDWgagctgcgaggggVtaaScNatttacttaatgacag
-cccccacatYScaMgtaggtYaNgttctgaMaacNaMRaacaaacaKctacatagYWctg
-ttWaaataaaataRattagHacacaagcgKatacBttRttaagtatttccgatctHSaat
-actcNttMaagtattMtgRtgaMgcataatHcMtaBSaRattagttgatHtMttaaKagg
-YtaaBataSaVatactWtataVWgKgttaaaacagtgcgRatatacatVtHRtVYataSa
-KtWaStVcNKHKttactatccctcatgWHatWaRcttactaggatctataDtDHBttata
-aaaHgtacVtagaYttYaKcctattcttcttaataNDaaggaaaDYgcggctaaWSctBa
-aNtgctggMBaKctaMVKagBaactaWaDaMaccYVtNtaHtVWtKgRtcaaNtYaNacg
-gtttNattgVtttctgtBaWgtaattcaagtcaVWtactNggattctttaYtaaagccgc
-tcttagHVggaYtgtNcDaVagctctctKgacgtatagYcctRYHDtgBattDaaDgccK
-tcHaaStttMcctagtattgcRgWBaVatHaaaataYtgtttagMDMRtaataaggatMt
-ttctWgtNtgtgaaaaMaatatRtttMtDgHHtgtcattttcWattRSHcVagaagtacg
-ggtaKVattKYagactNaatgtttgKMMgYNtcccgSKttctaStatatNVataYHgtNa
-BKRgNacaactgatttcctttaNcgatttctctataScaHtataRagtcRVttacDSDtt
-aRtSatacHgtSKacYagttMHtWataggatgactNtatSaNctataVtttRNKtgRacc
-tttYtatgttactttttcctttaaacatacaHactMacacggtWataMtBVacRaSaatc
-cgtaBVttccagccBcttaRKtgtgcctttttRtgtcagcRttKtaaacKtaaatctcac
-aattgcaNtSBaaccgggttattaaBcKatDagttactcttcattVtttHaaggctKKga
-tacatcBggScagtVcacattttgaHaDSgHatRMaHWggtatatRgccDttcgtatcga
-aacaHtaagttaRatgaVacttagattVKtaaYttaaatcaNatccRttRRaMScNaaaD
-gttVHWgtcHaaHgacVaWtgttScactaagSgttatcttagggDtaccagWattWtRtg
-ttHWHacgattBtgVcaYatcggttgagKcWtKKcaVtgaYgWctgYggVctgtHgaNcV
-taBtWaaYatcDRaaRtSctgaHaYRttagatMatgcatttNattaDttaattgttctaa
-ccctcccctagaWBtttHtBccttagaVaatMcBHagaVcWcagBVttcBtaYMccagat
-gaaaaHctctaacgttagNWRtcggattNatcRaNHttcagtKttttgWatWttcSaNgg
-gaWtactKKMaacatKatacNattgctWtatctaVgagctatgtRaHtYcWcttagccaa
-tYttWttaWSSttaHcaaaaagVacVgtaVaRMgattaVcDactttcHHggHRtgNcctt
-tYatcatKgctcctctatVcaaaaKaaaagtatatctgMtWtaaaacaStttMtcgactt
-taSatcgDataaactaaacaagtaaVctaggaSccaatMVtaaSKNVattttgHccatca
-cBVctgcaVatVttRtactgtVcaattHgtaaattaaattttYtatattaaRSgYtgBag
-aHSBDgtagcacRHtYcBgtcacttacactaYcgctWtattgSHtSatcataaatataHt
-cgtYaaMNgBaatttaRgaMaatatttBtttaaaHHKaatctgatWatYaacttMctctt
-ttVctagctDaaagtaVaKaKRtaacBgtatccaaccactHHaagaagaaggaNaaatBW
-attccgStaMSaMatBttgcatgRSacgttVVtaaDMtcSgVatWcaSatcttttVatag
-ttactttacgatcaccNtaDVgSRcgVcgtgaacgaNtaNatatagtHtMgtHcMtagaa
-attBgtataRaaaacaYKgtRccYtatgaagtaataKgtaaMttgaaRVatgcagaKStc
-tHNaaatctBBtcttaYaBWHgtVtgacagcaRcataWctcaBcYacYgatDgtDHccta
->THREE Homo sapiens frequency
-aacacttcaccaggtatcgtgaaggctcaagattacccagagaacctttgcaatataaga
-atatgtatgcagcattaccctaagtaattatattctttttctgactcaaagtgacaagcc
-ctagtgtatattaaatcggtatatttgggaaattcctcaaactatcctaatcaggtagcc
-atgaaagtgatcaaaaaagttcgtacttataccatacatgaattctggccaagtaaaaaa
-tagattgcgcaaaattcgtaccttaagtctctcgccaagatattaggatcctattactca
-tatcgtgtttttctttattgccgccatccccggagtatctcacccatccttctcttaaag
-gcctaatattacctatgcaaataaacatatattgttgaaaattgagaacctgatcgtgat
-tcttatgtgtaccatatgtatagtaatcacgcgactatatagtgctttagtatcgcccgt
-gggtgagtgaatattctgggctagcgtgagatagtttcttgtcctaatatttttcagatc
-gaatagcttctatttttgtgtttattgacatatgtcgaaactccttactcagtgaaagtc
-atgaccagatccacgaacaatcttcggaatcagtctcgttttacggcggaatcttgagtc
-taacttatatcccgtcgcttactttctaacaccccttatgtatttttaaaattacgttta
-ttcgaacgtacttggcggaagcgttattttttgaagtaagttacattgggcagactcttg
-acattttcgatacgactttctttcatccatcacaggactcgttcgtattgatatcagaag
-ctcgtgatgattagttgtcttctttaccaatactttgaggcctattctgcgaaatttttg
-ttgccctgcgaacttcacataccaaggaacacctcgcaacatgccttcatatccatcgtt
-cattgtaattcttacacaatgaatcctaagtaattacatccctgcgtaaaagatggtagg
-ggcactgaggatatattaccaagcatttagttatgagtaatcagcaatgtttcttgtatt
-aagttctctaaaatagttacatcgtaatgttatctcgggttccgcgaataaacgagatag
-attcattatatatggccctaagcaaaaacctcctcgtattctgttggtaattagaatcac
-acaatacgggttgagatattaattatttgtagtacgaagagatataaaaagatgaacaat
-tactcaagtcaagatgtatacgggatttataataaaaatcgggtagagatctgctttgca
-attcagacgtgccactaaatcgtaatatgtcgcgttacatcagaaagggtaactattatt
-aattaataaagggcttaatcactacatattagatcttatccgatagtcttatctattcgt
-tgtatttttaagcggttctaattcagtcattatatcagtgctccgagttctttattattg
-ttttaaggatgacaaaatgcctcttgttataacgctgggagaagcagactaagagtcgga
-gcagttggtagaatgaggctgcaaaagacggtctcgacgaatggacagactttactaaac
-caatgaaagacagaagtagagcaaagtctgaagtggtatcagcttaattatgacaaccct
-taatacttccctttcgccgaatactggcgtggaaaggttttaaaagtcgaagtagttaga
-ggcatctctcgctcataaataggtagactactcgcaatccaatgtgactatgtaatactg
-ggaacatcagtccgcgatgcagcgtgtttatcaaccgtccccactcgcctggggagacat
-gagaccacccccgtggggattattagtccgcagtaatcgactcttgacaatccttttcga
-ttatgtcatagcaatttacgacagttcagcgaagtgactactcggcgaaatggtattact
-aaagcattcgaacccacatgaatgtgattcttggcaatttctaatccactaaagcttttc
-cgttgaatctggttgtagatatttatataagttcactaattaagatcacggtagtatatt
-gatagtgatgtctttgcaagaggttggccgaggaatttacggattctctattgatacaat
-ttgtctggcttataactcttaaggctgaaccaggcgtttttagacgacttgatcagctgt
-tagaatggtttggactccctctttcatgtcagtaacatttcagccgttattgttacgata
-tgcttgaacaatattgatctaccacacacccatagtatattttataggtcatgctgttac
-ctacgagcatggtattccacttcccattcaatgagtattcaacatcactagcctcagaga
-tgatgacccacctctaataacgtcacgttgcggccatgtgaaacctgaacttgagtagac
-gatatcaagcgctttaaattgcatataacatttgagggtaaagctaagcggatgctttat
-ataatcaatactcaataataagatttgattgcattttagagttatgacacgacatagttc
-actaacgagttactattcccagatctagactgaagtactgatcgagacgatccttacgtc
-gatgatcgttagttatcgacttaggtcgggtctctagcggtattggtacttaaccggaca
-ctatactaataacccatgatcaaagcataacagaatacagacgataatttcgccaacata
-tatgtacagaccccaagcatgagaagctcattgaaagctatcattgaagtcccgctcaca
-atgtgtcttttccagacggtttaactggttcccgggagtcctggagtttcgacttacata
-aatggaaacaatgtattttgctaatttatctatagcgtcatttggaccaatacagaatat
-tatgttgcctagtaatccactataacccgcaagtgctgatagaaaatttttagacgattt
-ataaatgccccaagtatccctcccgtgaatcctccgttatactaattagtattcgttcat
-acgtataccgcgcatatatgaacatttggcgataaggcgcgtgaattgttacgtgacaga
-gatagcagtttcttgtgatatggttaacagacgtacatgaagggaaactttatatctata
-gtgatgcttccgtagaaataccgccactggtctgccaatgatgaagtatgtagctttagg
-tttgtactatgaggctttcgtttgtttgcagagtataacagttgcgagtgaaaaaccgac
-gaatttatactaatacgctttcactattggctacaaaatagggaagagtttcaatcatga
-gagggagtatatggatgctttgtagctaaaggtagaacgtatgtatatgctgccgttcat
-tcttgaaagatacataagcgataagttacgacaattataagcaacatccctaccttcgta
-acgatttcactgttactgcgcttgaaatacactatggggctattggcggagagaagcaga
-tcgcgccgagcatatacgagacctataatgttgatgatagagaaggcgtctgaattgata
-catcgaagtacactttctttcgtagtatctctcgtcctctttctatctccggacacaaga
-attaagttatatatatagagtcttaccaatcatgttgaatcctgattctcagagttcttt
-ggcgggccttgtgatgactgagaaacaatgcaatattgctccaaatttcctaagcaaatt
-ctcggttatgttatgttatcagcaaagcgttacgttatgttatttaaatctggaatgacg
-gagcgaagttcttatgtcggtgtgggaataattcttttgaagacagcactccttaaataa
-tatcgctccgtgtttgtatttatcgaatgggtctgtaaccttgcacaagcaaatcggtgg
-tgtatatatcggataacaattaatacgatgttcatagtgacagtatactgatcgagtcct
-ctaaagtcaattacctcacttaacaatctcattgatgttgtgtcattcccggtatcgccc
-gtagtatgtgctctgattgaccgagtgtgaaccaaggaacatctactaatgcctttgtta
-ggtaagatctctctgaattccttcgtgccaacttaaaacattatcaaaatttcttctact
-tggattaactacttttacgagcatggcaaattcccctgtggaagacggttcattattatc
-ggaaaccttatagaaattgcgtgttgactgaaattagatttttattgtaagagttgcatc
-tttgcgattcctctggtctagcttccaatgaacagtcctcccttctattcgacatcgggt
-ccttcgtacatgtctttgcgatgtaataattaggttcggagtgtggccttaatgggtgca
-actaggaatacaacgcaaatttgctgacatgatagcaaatcggtatgccggcaccaaaac
-gtgctccttgcttagcttgtgaatgagactcagtagttaaataaatccatatctgcaatc
-gattccacaggtattgtccactatctttgaactactctaagagatacaagcttagctgag
-accgaggtgtatatgactacgctgatatctgtaaggtaccaatgcaggcaaagtatgcga
-gaagctaataccggctgtttccagctttataagattaaaatttggctgtcctggcggcct
-cagaattgttctatcgtaatcagttggttcattaattagctaagtacgaggtacaactta
-tctgtcccagaacagctccacaagtttttttacagccgaaacccctgtgtgaatcttaat
-atccaagcgcgttatctgattagagtttacaactcagtattttatcagtacgttttgttt
-ccaacattacccggtatgacaaaatgacgccacgtgtcgaataatggtctgaccaatgta
-ggaagtgaaaagataaatat
diff --git a/test/bench/shootout/k-nucleotide-parallel.go b/test/bench/shootout/k-nucleotide-parallel.go
deleted file mode 100644
index 96c80d8..0000000
--- a/test/bench/shootout/k-nucleotide-parallel.go
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "runtime"
- "sort"
-)
-
-func count(data string, n int) map[string]int {
- counts := make(map[string]int)
- top := len(data) - n
- for i := 0; i <= top; i++ {
- s := data[i : i+n]
- counts[s]++
- }
- return counts
-}
-
-func countOne(data string, s string) int {
- return count(data, len(s))[s]
-}
-
-type kNuc struct {
- name string
- count int
-}
-
-type kNucArray []kNuc
-
-func (kn kNucArray) Len() int { return len(kn) }
-func (kn kNucArray) Swap(i, j int) { kn[i], kn[j] = kn[j], kn[i] }
-func (kn kNucArray) Less(i, j int) bool {
- if kn[i].count == kn[j].count {
- return kn[i].name > kn[j].name // sort down
- }
- return kn[i].count > kn[j].count
-}
-
-func sortedArray(m map[string]int) kNucArray {
- kn := make(kNucArray, len(m))
- i := 0
- for k, v := range m {
- kn[i] = kNuc{k, v}
- i++
- }
- sort.Sort(kn)
- return kn
-}
-
-func printKnucs(a kNucArray) {
- sum := 0
- for _, kn := range a {
- sum += kn.count
- }
- for _, kn := range a {
- fmt.Printf("%s %.3f\n", kn.name, 100*float64(kn.count)/float64(sum))
- }
- fmt.Print("\n")
-}
-
-func main() {
- runtime.GOMAXPROCS(4)
- in := bufio.NewReader(os.Stdin)
- three := []byte(">THREE ")
- for {
- line, err := in.ReadSlice('\n')
- if err != nil {
- fmt.Fprintln(os.Stderr, "ReadLine err:", err)
- os.Exit(2)
- }
- if line[0] == '>' && bytes.Equal(line[0:len(three)], three) {
- break
- }
- }
- data, err := ioutil.ReadAll(in)
- if err != nil {
- fmt.Fprintln(os.Stderr, "ReadAll err:", err)
- os.Exit(2)
- }
- // delete the newlines and convert to upper case
- j := 0
- for i := 0; i < len(data); i++ {
- if data[i] != '\n' {
- data[j] = data[i] &^ ' ' // upper case
- j++
- }
- }
- str := string(data[0:j])
-
- var arr1, arr2 kNucArray
- countsdone := make(chan bool)
- go func() {
- arr1 = sortedArray(count(str, 1))
- countsdone <- true
- }()
- go func() {
- arr2 = sortedArray(count(str, 2))
- countsdone <- true
- }()
-
- interests := []string{"GGT", "GGTA", "GGTATT", "GGTATTTTAATT", "GGTATTTTAATTTATAGT"}
- results := make([]chan string, len(interests))
- for i, s := range interests {
- ch := make(chan string)
- results[i] = ch
- go func(result chan string, ss string) {
- result <- fmt.Sprintf("%d %s\n", countOne(str, ss), ss)
- }(ch, s)
- }
- <-countsdone
- <-countsdone
- printKnucs(arr1)
- printKnucs(arr2)
- for _, rc := range results {
- fmt.Print(<-rc)
- }
-
-}
diff --git a/test/bench/shootout/k-nucleotide-parallel.txt b/test/bench/shootout/k-nucleotide-parallel.txt
deleted file mode 100644
index 84169b8..0000000
--- a/test/bench/shootout/k-nucleotide-parallel.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-T 31.520
-A 29.600
-C 19.480
-G 19.400
-
-AT 9.922
-TT 9.602
-TA 9.402
-AA 8.402
-GA 6.321
-TC 6.301
-TG 6.201
-GT 6.041
-CT 5.961
-AG 5.841
-CA 5.461
-AC 5.441
-CC 4.041
-CG 4.021
-GC 3.701
-GG 3.341
-
-54 GGT
-24 GGTA
-4 GGTATT
-0 GGTATTTTAATT
-0 GGTATTTTAATTTATAGT
diff --git a/test/bench/shootout/k-nucleotide.c b/test/bench/shootout/k-nucleotide.c
deleted file mode 100644
index 9c30620..0000000
--- a/test/bench/shootout/k-nucleotide.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <glib.h>
-
-typedef struct stat_s stat_t;
-struct stat_s
-{
- const gchar *key;
- long stat;
-};
-
-#define MAX_ELM (8192 / sizeof (stat_t))
-
-static int
-generate_frequencies (int fl, char *buffer, long buflen,
- GHashTable *ht, GTrashStack **ts, GPtrArray *roots, GStringChunk *sc)
-{
- gchar *key;
- long i;
-
- if (fl > buflen) return 0;
- if (fl == 0) return 0;
-
- for (i = 0; i < buflen - fl + 1; ++i)
- {
- char nulled;
- stat_t *stat;
-
- nulled = buffer[i + fl];
- buffer[i + fl] = '\0';
-
- key = g_string_chunk_insert_const(sc, buffer + i);
-
- stat = g_hash_table_lookup(ht, key);
- if (!stat)
- {
- stat = g_trash_stack_pop(ts);
- if (!stat)
- {
- int j;
-
- stat = malloc(sizeof (stat_t) * MAX_ELM);
- g_ptr_array_add(roots, stat);
-
- for (j = 1; j < MAX_ELM; ++j)
- g_trash_stack_push(ts, stat + j);
- }
- stat->stat = 1;
- stat->key = key;
-
- g_hash_table_insert(ht, key, stat);
- }
- else
- stat->stat++;
-
- buffer[i + fl] = nulled;
- }
-
- return buflen - fl + 1;
-}
-
-static int
-cmp_func(gconstpointer a, gconstpointer b)
-{
- const stat_t *left = a;
- const stat_t *right = b;
-
- return right->stat - left->stat;
-}
-
-static void
-sorted_list(gpointer key, gpointer value, gpointer user_data)
-{
- stat_t *data = value;
- GList **lst = user_data;
-
- *lst = g_list_insert_sorted(*lst, data, cmp_func);
-}
-
-static void
-display_stat(gpointer data, gpointer user_data)
-{
- long *total = user_data;
- stat_t *st = data;
-
- printf("%s %.3f\n", st->key, 100 * (float) st->stat / *total);
-}
-
-void
-write_frequencies (int fl, char *buffer, long buflen, GTrashStack **ts, GPtrArray *roots)
-{
- GStringChunk *sc;
- GHashTable *ht;
- GList *lst;
- long total;
-
- ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL /* free key */, NULL /* free value */);
- sc = g_string_chunk_new(buflen);
- lst = NULL;
-
- total = generate_frequencies (fl, buffer, buflen, ht, ts, roots, sc);
-
- if (!total) goto on_error;
-
- g_hash_table_foreach(ht, sorted_list, &lst);
- g_list_foreach(lst, display_stat, &total);
- g_list_free(lst);
-
- on_error:
- g_hash_table_destroy(ht);
- g_string_chunk_free(sc);
-}
-
-void
-write_count (char *searchFor, char *buffer, long buflen, GTrashStack **ts, GPtrArray *roots)
-{
- GStringChunk *sc;
- GHashTable *ht;
- stat_t *result;
- GList *lst;
- long total;
- long fl;
-
- fl = strlen(searchFor);
-
- ht = g_hash_table_new_full(g_str_hash, g_str_equal, NULL /* free key */, NULL /* free value */);
- sc = g_string_chunk_new(buflen);
- lst = NULL;
- result = NULL;
-
- total = generate_frequencies (fl, buffer, buflen, ht, ts, roots, sc);
-
- if (!total) goto on_error;
-
- result = g_hash_table_lookup(ht, searchFor);
-
- on_error:
- printf("%ld\t%s\n", result ? result->stat : 0, searchFor);
-
- g_hash_table_destroy(ht);
- g_string_chunk_free(sc);
-}
-
-int
-main ()
-{
- char buffer[4096];
- GTrashStack *ts;
- GPtrArray *roots;
- GString *stuff;
- gchar *s;
- int len;
-
- roots = g_ptr_array_new();
- ts = NULL;
-
- while (fgets(buffer, sizeof (buffer), stdin))
- if (strncmp(buffer, ">THREE", 6) == 0)
- break;
-
- stuff = g_string_new(NULL);
-
- while (fgets(buffer, sizeof (buffer), stdin))
- {
- size_t sz;
-
- if (buffer[0] == '>')
- break;
-
- sz = strlen(buffer);
- if (buffer[sz - 1] == '\n')
- --sz;
-
- stuff = g_string_append_len(stuff, buffer, sz);
- }
-
- stuff = g_string_ascii_up(stuff);
- len = stuff->len;
- s = g_string_free(stuff, FALSE);
-
- write_frequencies(1, s, len, &ts, roots);
- printf("\n");
- write_frequencies(2, s, len, &ts, roots);
- printf("\n");
- write_count("GGT", s, len, &ts, roots);
- write_count("GGTA", s, len, &ts, roots);
- write_count("GGTATT", s, len, &ts, roots);
- write_count("GGTATTTTAATT", s, len, &ts, roots);
- write_count("GGTATTTTAATTTATAGT", s, len, &ts, roots);
-
- free(s);
-
- g_ptr_array_foreach(roots, (GFunc)free, NULL);
- g_ptr_array_free(roots, TRUE);
-
- return 0;
-}
diff --git a/test/bench/shootout/k-nucleotide.go b/test/bench/shootout/k-nucleotide.go
deleted file mode 100644
index fdc98ed..0000000
--- a/test/bench/shootout/k-nucleotide.go
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "bufio"
- "bytes"
- "fmt"
- "io/ioutil"
- "os"
- "sort"
-)
-
-var in *bufio.Reader
-
-func count(data string, n int) map[string]int {
- counts := make(map[string]int)
- top := len(data) - n
- for i := 0; i <= top; i++ {
- s := data[i : i+n]
- counts[s]++
- }
- return counts
-}
-
-func countOne(data string, s string) int {
- return count(data, len(s))[s]
-}
-
-type kNuc struct {
- name string
- count int
-}
-
-type kNucArray []kNuc
-
-func (kn kNucArray) Len() int { return len(kn) }
-func (kn kNucArray) Swap(i, j int) { kn[i], kn[j] = kn[j], kn[i] }
-func (kn kNucArray) Less(i, j int) bool {
- if kn[i].count == kn[j].count {
- return kn[i].name > kn[j].name // sort down
- }
- return kn[i].count > kn[j].count
-}
-
-func sortedArray(m map[string]int) kNucArray {
- kn := make(kNucArray, len(m))
- i := 0
- for k, v := range m {
- kn[i].name = k
- kn[i].count = v
- i++
- }
- sort.Sort(kn)
- return kn
-}
-
-func print(m map[string]int) {
- a := sortedArray(m)
- sum := 0
- for _, kn := range a {
- sum += kn.count
- }
- for _, kn := range a {
- fmt.Printf("%s %.3f\n", kn.name, 100*float64(kn.count)/float64(sum))
- }
-}
-
-func main() {
- in = bufio.NewReader(os.Stdin)
- three := []byte(">THREE ")
- for {
- line, err := in.ReadSlice('\n')
- if err != nil {
- fmt.Fprintln(os.Stderr, "ReadLine err:", err)
- os.Exit(2)
- }
- if line[0] == '>' && bytes.Equal(line[0:len(three)], three) {
- break
- }
- }
- data, err := ioutil.ReadAll(in)
- if err != nil {
- fmt.Fprintln(os.Stderr, "ReadAll err:", err)
- os.Exit(2)
- }
- // delete the newlines and convert to upper case
- j := 0
- for i := 0; i < len(data); i++ {
- if data[i] != '\n' {
- data[j] = data[i] &^ ' ' // upper case
- j++
- }
- }
- str := string(data[0:j])
-
- print(count(str, 1))
- fmt.Print("\n")
-
- print(count(str, 2))
- fmt.Print("\n")
-
- interests := []string{"GGT", "GGTA", "GGTATT", "GGTATTTTAATT", "GGTATTTTAATTTATAGT"}
- for _, s := range interests {
- fmt.Printf("%d %s\n", countOne(str, s), s)
- }
-}
diff --git a/test/bench/shootout/k-nucleotide.txt b/test/bench/shootout/k-nucleotide.txt
deleted file mode 100644
index 84169b8..0000000
--- a/test/bench/shootout/k-nucleotide.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-T 31.520
-A 29.600
-C 19.480
-G 19.400
-
-AT 9.922
-TT 9.602
-TA 9.402
-AA 8.402
-GA 6.321
-TC 6.301
-TG 6.201
-GT 6.041
-CT 5.961
-AG 5.841
-CA 5.461
-AC 5.441
-CC 4.041
-CG 4.021
-GC 3.701
-GG 3.341
-
-54 GGT
-24 GGTA
-4 GGTATT
-0 GGTATTTTAATT
-0 GGTATTTTAATTTATAGT
diff --git a/test/bench/shootout/mandelbrot.c b/test/bench/shootout/mandelbrot.c
deleted file mode 100644
index c177c08..0000000
--- a/test/bench/shootout/mandelbrot.c
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Shootout
- http://shootout.alioth.debian.org/
-
- contributed by Greg Buchholz
-
- for the debian (AMD) machine...
- compile flags: -O3 -ffast-math -march=athlon-xp -funroll-loops
-
- for the gp4 (Intel) machine...
- compile flags: -O3 -ffast-math -march=pentium4 -funroll-loops
-*/
-
-#include<stdio.h>
-
-int main (int argc, char **argv)
-{
- int w, h, bit_num = 0;
- char byte_acc = 0;
- int i, iter = 50;
- double x, y, limit = 2.0;
- double Zr, Zi, Cr, Ci, Tr, Ti;
-
- w = h = atoi(argv[1]);
-
- printf("P4\n%d %d\n",w,h);
-
- for(y=0;y<h;++y)
- {
- for(x=0;x<w;++x)
- {
- Zr = Zi = Tr = Ti = 0.0;
- Cr = (2.0*x/w - 1.5); Ci=(2.0*y/h - 1.0);
-
- for (i=0;i<iter && (Tr+Ti <= limit*limit);++i)
- {
- Zi = 2.0*Zr*Zi + Ci;
- Zr = Tr - Ti + Cr;
- Tr = Zr * Zr;
- Ti = Zi * Zi;
- }
-
- byte_acc <<= 1;
- if(Tr+Ti <= limit*limit) byte_acc |= 0x01;
-
- ++bit_num;
-
- if(bit_num == 8)
- {
- putc(byte_acc,stdout);
- byte_acc = 0;
- bit_num = 0;
- }
- else if(x == w-1)
- {
- byte_acc <<= (8-w%8);
- putc(byte_acc,stdout);
- byte_acc = 0;
- bit_num = 0;
- }
- }
- }
-}
diff --git a/test/bench/shootout/mandelbrot.go b/test/bench/shootout/mandelbrot.go
deleted file mode 100644
index df60343..0000000
--- a/test/bench/shootout/mandelbrot.go
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * Based on mandelbrot.c contributed by Greg Buchholz
- */
-
-package main
-
-import (
- "bufio"
- "flag"
- "fmt"
- "os"
-)
-
-var n = flag.Int("n", 200, "size")
-
-func main() {
- flag.Parse()
- out := bufio.NewWriter(os.Stdout)
- defer out.Flush()
-
- w := float64(*n)
- h := float64(*n)
- bit_num := 0
- byte_acc := byte(0)
- const Iter = 50
- const Zero float64 = 0
- const Limit = 2.0
-
- fmt.Fprintf(out, "P4\n%d %d\n", *n, *n)
-
- for y := 0.0; y < h; y++ {
- for x := 0.0; x < w; x++ {
- Zr, Zi, Tr, Ti := Zero, Zero, Zero, Zero
- Cr := (2*x/w - 1.5)
- Ci := (2*y/h - 1.0)
-
- for i := 0; i < Iter && (Tr+Ti <= Limit*Limit); i++ {
- Zi = 2*Zr*Zi + Ci
- Zr = Tr - Ti + Cr
- Tr = Zr * Zr
- Ti = Zi * Zi
- }
-
- byte_acc <<= 1
- if Tr+Ti <= Limit*Limit {
- byte_acc |= 0x01
- }
-
- bit_num++
-
- if bit_num == 8 {
- out.WriteByte(byte_acc)
- byte_acc = 0
- bit_num = 0
- } else if x == w-1 {
- byte_acc <<= uint(8 - uint(*n)%8)
- out.WriteByte(byte_acc)
- byte_acc = 0
- bit_num = 0
- }
- }
- }
-}
diff --git a/test/bench/shootout/mandelbrot.txt b/test/bench/shootout/mandelbrot.txt
deleted file mode 100644
index 2f7bbbc..0000000
--- a/test/bench/shootout/mandelbrot.txt
+++ /dev/null
Binary files differ
diff --git a/test/bench/shootout/meteor-contest.c b/test/bench/shootout/meteor-contest.c
deleted file mode 100644
index 19c4340..0000000
--- a/test/bench/shootout/meteor-contest.c
+++ /dev/null
@@ -1,626 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by Christian Vosteen
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#define TRUE 1
-#define FALSE 0
-
-/* The board is a 50 cell hexagonal pattern. For . . . . .
- * maximum speed the board will be implemented as . . . . .
- * 50 bits, which will fit into a 64 bit long long . . . . .
- * int. . . . . .
- * . . . . .
- * I will represent 0's as empty cells and 1's . . . . .
- * as full cells. . . . . .
- * . . . . .
- * . . . . .
- * . . . . .
- */
-
-unsigned long long board = 0xFFFC000000000000ULL;
-
-/* The puzzle pieces must be specified by the path followed
- * from one end to the other along 12 hexagonal directions.
- *
- * Piece 0 Piece 1 Piece 2 Piece 3 Piece 4
- *
- * O O O O O O O O O O O O O O O
- * O O O O O O O
- * O O O
- *
- * Piece 5 Piece 6 Piece 7 Piece 8 Piece 9
- *
- * O O O O O O O O O O O O O
- * O O O O O O O O O
- * O O O
- *
- * I had to make it 12 directions because I wanted all of the
- * piece definitions to fit into the same size arrays. It is
- * not possible to define piece 4 in terms of the 6 cardinal
- * directions in 4 moves.
- */
-
-#define E 0
-#define ESE 1
-#define SE 2
-#define S 3
-#define SW 4
-#define WSW 5
-#define W 6
-#define WNW 7
-#define NW 8
-#define N 9
-#define NE 10
-#define ENE 11
-#define PIVOT 12
-
-char piece_def[10][4] = {
- { E, E, E, SE},
- { SE, E, NE, E},
- { E, E, SE, SW},
- { E, E, SW, SE},
- { SE, E, NE, S},
- { E, E, SW, E},
- { E, SE, SE, NE},
- { E, SE, SE, W},
- { E, SE, E, E},
- { E, E, E, SW}
-};
-
-
-/* To minimize the amount of work done in the recursive solve function below,
- * I'm going to allocate enough space for all legal rotations of each piece
- * at each position on the board. That's 10 pieces x 50 board positions x
- * 12 rotations. However, not all 12 rotations will fit on every cell, so
- * I'll have to keep count of the actual number that do.
- * The pieces are going to be unsigned long long ints just like the board so
- * they can be bitwise-anded with the board to determine if they fit.
- * I'm also going to record the next possible open cell for each piece and
- * location to reduce the burden on the solve function.
- */
-unsigned long long pieces[10][50][12];
-int piece_counts[10][50];
-char next_cell[10][50][12];
-
-/* Returns the direction rotated 60 degrees clockwise */
-char rotate(char dir) {
- return (dir + 2) % PIVOT;
-}
-
-/* Returns the direction flipped on the horizontal axis */
-char flip(char dir) {
- return (PIVOT - dir) % PIVOT;
-}
-
-
-/* Returns the new cell index from the specified cell in the
- * specified direction. The index is only valid if the
- * starting cell and direction have been checked by the
- * out_of_bounds function first.
- */
-char shift(char cell, char dir) {
- switch(dir) {
- case E:
- return cell + 1;
- case ESE:
- if((cell / 5) % 2)
- return cell + 7;
- else
- return cell + 6;
- case SE:
- if((cell / 5) % 2)
- return cell + 6;
- else
- return cell + 5;
- case S:
- return cell + 10;
- case SW:
- if((cell / 5) % 2)
- return cell + 5;
- else
- return cell + 4;
- case WSW:
- if((cell / 5) % 2)
- return cell + 4;
- else
- return cell + 3;
- case W:
- return cell - 1;
- case WNW:
- if((cell / 5) % 2)
- return cell - 6;
- else
- return cell - 7;
- case NW:
- if((cell / 5) % 2)
- return cell - 5;
- else
- return cell - 6;
- case N:
- return cell - 10;
- case NE:
- if((cell / 5) % 2)
- return cell - 4;
- else
- return cell - 5;
- case ENE:
- if((cell / 5) % 2)
- return cell - 3;
- else
- return cell - 4;
- default:
- return cell;
- }
-}
-
-/* Returns wether the specified cell and direction will land outside
- * of the board. Used to determine if a piece is at a legal board
- * location or not.
- */
-char out_of_bounds(char cell, char dir) {
- char i;
- switch(dir) {
- case E:
- return cell % 5 == 4;
- case ESE:
- i = cell % 10;
- return i == 4 || i == 8 || i == 9 || cell >= 45;
- case SE:
- return cell % 10 == 9 || cell >= 45;
- case S:
- return cell >= 40;
- case SW:
- return cell % 10 == 0 || cell >= 45;
- case WSW:
- i = cell % 10;
- return i == 0 || i == 1 || i == 5 || cell >= 45;
- case W:
- return cell % 5 == 0;
- case WNW:
- i = cell % 10;
- return i == 0 || i == 1 || i == 5 || cell < 5;
- case NW:
- return cell % 10 == 0 || cell < 5;
- case N:
- return cell < 10;
- case NE:
- return cell % 10 == 9 || cell < 5;
- case ENE:
- i = cell % 10;
- return i == 4 || i == 8 || i == 9 || cell < 5;
- default:
- return FALSE;
- }
-}
-
-/* Rotate a piece 60 degrees clockwise */
-void rotate_piece(int piece) {
- int i;
- for(i = 0; i < 4; i++)
- piece_def[piece][i] = rotate(piece_def[piece][i]);
-}
-
-/* Flip a piece along the horizontal axis */
-void flip_piece(int piece) {
- int i;
- for(i = 0; i < 4; i++)
- piece_def[piece][i] = flip(piece_def[piece][i]);
-}
-
-/* Convenience function to quickly calculate all of the indices for a piece */
-void calc_cell_indices(char *cell, int piece, char index) {
- cell[0] = index;
- cell[1] = shift(cell[0], piece_def[piece][0]);
- cell[2] = shift(cell[1], piece_def[piece][1]);
- cell[3] = shift(cell[2], piece_def[piece][2]);
- cell[4] = shift(cell[3], piece_def[piece][3]);
-}
-
-/* Convenience function to quickly calculate if a piece fits on the board */
-int cells_fit_on_board(char *cell, int piece) {
- return (!out_of_bounds(cell[0], piece_def[piece][0]) &&
- !out_of_bounds(cell[1], piece_def[piece][1]) &&
- !out_of_bounds(cell[2], piece_def[piece][2]) &&
- !out_of_bounds(cell[3], piece_def[piece][3]));
-}
-
-/* Returns the lowest index of the cells of a piece.
- * I use the lowest index that a piece occupies as the index for looking up
- * the piece in the solve function.
- */
-char minimum_of_cells(char *cell) {
- char minimum = cell[0];
- minimum = cell[1] < minimum ? cell[1] : minimum;
- minimum = cell[2] < minimum ? cell[2] : minimum;
- minimum = cell[3] < minimum ? cell[3] : minimum;
- minimum = cell[4] < minimum ? cell[4] : minimum;
- return minimum;
-}
-
-/* Calculate the lowest possible open cell if the piece is placed on the board.
- * Used to later reduce the amount of time searching for open cells in the
- * solve function.
- */
-char first_empty_cell(char *cell, char minimum) {
- char first_empty = minimum;
- while(first_empty == cell[0] || first_empty == cell[1] ||
- first_empty == cell[2] || first_empty == cell[3] ||
- first_empty == cell[4])
- first_empty++;
- return first_empty;
-}
-
-/* Generate the unsigned long long int that will later be anded with the
- * board to determine if it fits.
- */
-unsigned long long bitmask_from_cells(char *cell) {
- unsigned long long piece_mask = 0ULL;
- int i;
- for(i = 0; i < 5; i++)
- piece_mask |= 1ULL << cell[i];
- return piece_mask;
-}
-
-/* Record the piece and other important information in arrays that will
- * later be used by the solve function.
- */
-void record_piece(int piece, int minimum, char first_empty,
- unsigned long long piece_mask) {
- pieces[piece][minimum][piece_counts[piece][minimum]] = piece_mask;
- next_cell[piece][minimum][piece_counts[piece][minimum]] = first_empty;
- piece_counts[piece][minimum]++;
-}
-
-
-/* Fill the entire board going cell by cell. If any cells are "trapped"
- * they will be left alone.
- */
-void fill_contiguous_space(char *board, int index) {
- if(board[index] == 1)
- return;
- board[index] = 1;
- if(!out_of_bounds(index, E))
- fill_contiguous_space(board, shift(index, E));
- if(!out_of_bounds(index, SE))
- fill_contiguous_space(board, shift(index, SE));
- if(!out_of_bounds(index, SW))
- fill_contiguous_space(board, shift(index, SW));
- if(!out_of_bounds(index, W))
- fill_contiguous_space(board, shift(index, W));
- if(!out_of_bounds(index, NW))
- fill_contiguous_space(board, shift(index, NW));
- if(!out_of_bounds(index, NE))
- fill_contiguous_space(board, shift(index, NE));
-}
-
-
-/* To thin the number of pieces, I calculate if any of them trap any empty
- * cells at the edges. There are only a handful of exceptions where the
- * the board can be solved with the trapped cells. For example: piece 8 can
- * trap 5 cells in the corner, but piece 3 can fit in those cells, or piece 0
- * can split the board in half where both halves are viable.
- */
-int has_island(char *cell, int piece) {
- char temp_board[50];
- char c;
- int i;
- for(i = 0; i < 50; i++)
- temp_board[i] = 0;
- for(i = 0; i < 5; i++)
- temp_board[((int)cell[i])] = 1;
- i = 49;
- while(temp_board[i] == 1)
- i--;
- fill_contiguous_space(temp_board, i);
- c = 0;
- for(i = 0; i < 50; i++)
- if(temp_board[i] == 0)
- c++;
- if(c == 0 || (c == 5 && piece == 8) || (c == 40 && piece == 8) ||
- (c % 5 == 0 && piece == 0))
- return FALSE;
- else
- return TRUE;
-}
-
-
-/* Calculate all six rotations of the specified piece at the specified index.
- * We calculate only half of piece 3's rotations. This is because any solution
- * found has an identical solution rotated 180 degrees. Thus we can reduce the
- * number of attempted pieces in the solve algorithm by not including the 180-
- * degree-rotated pieces of ONE of the pieces. I chose piece 3 because it gave
- * me the best time ;)
- */
- void calc_six_rotations(char piece, char index) {
- char rotation, cell[5];
- char minimum, first_empty;
- unsigned long long piece_mask;
-
- for(rotation = 0; rotation < 6; rotation++) {
- if(piece != 3 || rotation < 3) {
- calc_cell_indices(cell, piece, index);
- if(cells_fit_on_board(cell, piece) && !has_island(cell, piece)) {
- minimum = minimum_of_cells(cell);
- first_empty = first_empty_cell(cell, minimum);
- piece_mask = bitmask_from_cells(cell);
- record_piece(piece, minimum, first_empty, piece_mask);
- }
- }
- rotate_piece(piece);
- }
-}
-
-/* Calculate every legal rotation for each piece at each board location. */
-void calc_pieces(void) {
- char piece, index;
-
- for(piece = 0; piece < 10; piece++) {
- for(index = 0; index < 50; index++) {
- calc_six_rotations(piece, index);
- flip_piece(piece);
- calc_six_rotations(piece, index);
- }
- }
-}
-
-
-
-/* Calculate all 32 possible states for a 5-bit row and all rows that will
- * create islands that follow any of the 32 possible rows. These pre-
- * calculated 5-bit rows will be used to find islands in a partially solved
- * board in the solve function.
- */
-#define ROW_MASK 0x1F
-#define TRIPLE_MASK 0x7FFF
-char all_rows[32] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31};
-int bad_even_rows[32][32];
-int bad_odd_rows[32][32];
-int bad_even_triple[32768];
-int bad_odd_triple[32768];
-
-int rows_bad(char row1, char row2, int even) {
- /* even is referring to row1 */
- int i, in_zeroes, group_okay;
- char block, row2_shift;
- /* Test for blockages at same index and shifted index */
- if(even)
- row2_shift = ((row2 << 1) & ROW_MASK) | 0x01;
- else
- row2_shift = (row2 >> 1) | 0x10;
- block = ((row1 ^ row2) & row2) & ((row1 ^ row2_shift) & row2_shift);
- /* Test for groups of 0's */
- in_zeroes = FALSE;
- group_okay = FALSE;
- for(i = 0; i < 5; i++) {
- if(row1 & (1 << i)) {
- if(in_zeroes) {
- if(!group_okay)
- return TRUE;
- in_zeroes = FALSE;
- group_okay = FALSE;
- }
- } else {
- if(!in_zeroes)
- in_zeroes = TRUE;
- if(!(block & (1 << i)))
- group_okay = TRUE;
- }
- }
- if(in_zeroes)
- return !group_okay;
- else
- return FALSE;
-}
-
-/* Check for cases where three rows checked sequentially cause a false
- * positive. One scenario is when 5 cells may be surrounded where piece 5
- * or 7 can fit. The other scenario is when piece 2 creates a hook shape.
- */
-int triple_is_okay(char row1, char row2, char row3, int even) {
- if(even) {
- /* There are four cases:
- * row1: 00011 00001 11001 10101
- * row2: 01011 00101 10001 10001
- * row3: 011?? 00110 ????? ?????
- */
- return ((row1 == 0x03) && (row2 == 0x0B) && ((row3 & 0x1C) == 0x0C)) ||
- ((row1 == 0x01) && (row2 == 0x05) && (row3 == 0x06)) ||
- ((row1 == 0x19) && (row2 == 0x11)) ||
- ((row1 == 0x15) && (row2 == 0x11));
- } else {
- /* There are two cases:
- * row1: 10011 10101
- * row2: 10001 10001
- * row3: ????? ?????
- */
- return ((row1 == 0x13) && (row2 == 0x11)) ||
- ((row1 == 0x15) && (row2 == 0x11));
- }
-}
-
-
-void calc_rows(void) {
- int row1, row2, row3;
- int result1, result2;
- for(row1 = 0; row1 < 32; row1++) {
- for(row2 = 0; row2 < 32; row2++) {
- bad_even_rows[row1][row2] = rows_bad(row1, row2, TRUE);
- bad_odd_rows[row1][row2] = rows_bad(row1, row2, FALSE);
- }
- }
- for(row1 = 0; row1 < 32; row1++) {
- for(row2 = 0; row2 < 32; row2++) {
- for(row3 = 0; row3 < 32; row3++) {
- result1 = bad_even_rows[row1][row2];
- result2 = bad_odd_rows[row2][row3];
- if(result1 == FALSE && result2 == TRUE
- && triple_is_okay(row1, row2, row3, TRUE))
- bad_even_triple[row1+(row2*32)+(row3*1024)] = FALSE;
- else
- bad_even_triple[row1+(row2*32)+(row3*1024)] = result1 || result2;
-
- result1 = bad_odd_rows[row1][row2];
- result2 = bad_even_rows[row2][row3];
- if(result1 == FALSE && result2 == TRUE
- && triple_is_okay(row1, row2, row3, FALSE))
- bad_odd_triple[row1+(row2*32)+(row3*1024)] = FALSE;
- else
- bad_odd_triple[row1+(row2*32)+(row3*1024)] = result1 || result2;
- }
- }
- }
-}
-
-
-
-/* Calculate islands while solving the board.
- */
-int boardHasIslands(char cell) {
- /* Too low on board, don't bother checking */
- if(cell >= 40)
- return FALSE;
- int current_triple = (board >> ((cell / 5) * 5)) & TRIPLE_MASK;
- if((cell / 5) % 2)
- return bad_odd_triple[current_triple];
- else
- return bad_even_triple[current_triple];
-}
-
-
-/* The recursive solve algorithm. Try to place each permutation in the upper-
- * leftmost empty cell. Mark off available pieces as it goes along.
- * Because the board is a bit mask, the piece number and bit mask must be saved
- * at each successful piece placement. This data is used to create a 50 char
- * array if a solution is found.
- */
-short avail = 0x03FF;
-char sol_nums[10];
-unsigned long long sol_masks[10];
-signed char solutions[2100][50];
-int solution_count = 0;
-int max_solutions = 2100;
-
-void record_solution(void) {
- int sol_no, index;
- unsigned long long sol_mask;
- for(sol_no = 0; sol_no < 10; sol_no++) {
- sol_mask = sol_masks[sol_no];
- for(index = 0; index < 50; index++) {
- if(sol_mask & 1ULL) {
- solutions[solution_count][index] = sol_nums[sol_no];
- /* Board rotated 180 degrees is a solution too! */
- solutions[solution_count+1][49-index] = sol_nums[sol_no];
- }
- sol_mask = sol_mask >> 1;
- }
- }
- solution_count += 2;
-}
-
-void solve(int depth, int cell) {
- int piece, rotation, max_rots;
- unsigned long long *piece_mask;
- short piece_no_mask;
-
- if(solution_count >= max_solutions)
- return;
-
- while(board & (1ULL << cell))
- cell++;
-
- for(piece = 0; piece < 10; piece++) {
- piece_no_mask = 1 << piece;
- if(!(avail & piece_no_mask))
- continue;
- avail ^= piece_no_mask;
- max_rots = piece_counts[piece][cell];
- piece_mask = pieces[piece][cell];
- for(rotation = 0; rotation < max_rots; rotation++) {
- if(!(board & *(piece_mask + rotation))) {
- sol_nums[depth] = piece;
- sol_masks[depth] = *(piece_mask + rotation);
- if(depth == 9) {
- /* Solution found!!!!!11!!ONE! */
- record_solution();
- avail ^= piece_no_mask;
- return;
- }
- board |= *(piece_mask + rotation);
- if(!boardHasIslands(next_cell[piece][cell][rotation]))
- solve(depth + 1, next_cell[piece][cell][rotation]);
- board ^= *(piece_mask + rotation);
- }
- }
- avail ^= piece_no_mask;
- }
-}
-
-
-/* qsort comparator - used to find first and last solutions */
-int solution_sort(const void *elem1, const void *elem2) {
- signed char *char1 = (signed char *) elem1;
- signed char *char2 = (signed char *) elem2;
- int i = 0;
- while(i < 50 && char1[i] == char2[i])
- i++;
- return char1[i] - char2[i];
-}
-
-
-/* pretty print a board in the specified hexagonal format */
-void pretty(signed char *b) {
- int i;
- for(i = 0; i < 50; i += 10) {
- printf("%c %c %c %c %c \n %c %c %c %c %c \n", b[i]+'0', b[i+1]+'0',
- b[i+2]+'0', b[i+3]+'0', b[i+4]+'0', b[i+5]+'0', b[i+6]+'0',
- b[i+7]+'0', b[i+8]+'0', b[i+9]+'0');
- }
- printf("\n");
-}
-
-int main(int argc, char **argv) {
- if(argc > 1)
- max_solutions = atoi(argv[1]);
- calc_pieces();
- calc_rows();
- solve(0, 0);
- printf("%d solutions found\n\n", solution_count);
- qsort(solutions, solution_count, 50 * sizeof(signed char), solution_sort);
- pretty(solutions[0]);
- pretty(solutions[solution_count-1]);
- return 0;
-}
diff --git a/test/bench/shootout/meteor-contest.go b/test/bench/shootout/meteor-contest.go
deleted file mode 100644
index 34a4e23..0000000
--- a/test/bench/shootout/meteor-contest.go
+++ /dev/null
@@ -1,656 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * based on meteor-contest.c by Christian Vosteen
- */
-
-package main
-
-import (
- "flag"
- "fmt"
-)
-
-var max_solutions = flag.Int("n", 2100, "maximum number of solutions")
-
-func boolInt(b bool) int8 {
- if b {
- return 1
- }
- return 0
-}
-
-/* The board is a 50 cell hexagonal pattern. For . . . . .
- * maximum speed the board will be implemented as . . . . .
- * 50 bits, which will fit into a 64 bit long long . . . . .
- * int. . . . . .
- * . . . . .
- * I will represent 0's as empty cells and 1's . . . . .
- * as full cells. . . . . .
- * . . . . .
- * . . . . .
- * . . . . .
- */
-
-var board uint64 = 0xFFFC000000000000
-
-/* The puzzle pieces must be specified by the path followed
- * from one end to the other along 12 hexagonal directions.
- *
- * Piece 0 Piece 1 Piece 2 Piece 3 Piece 4
- *
- * O O O O O O O O O O O O O O O
- * O O O O O O O
- * O O O
- *
- * Piece 5 Piece 6 Piece 7 Piece 8 Piece 9
- *
- * O O O O O O O O O O O O O
- * O O O O O O O O O
- * O O O
- *
- * I had to make it 12 directions because I wanted all of the
- * piece definitions to fit into the same size arrays. It is
- * not possible to define piece 4 in terms of the 6 cardinal
- * directions in 4 moves.
- */
-
-const (
- E = iota
- ESE
- SE
- S
- SW
- WSW
- W
- WNW
- NW
- N
- NE
- ENE
- PIVOT
-)
-
-var piece_def = [10][4]int8{
- [4]int8{E, E, E, SE},
- [4]int8{SE, E, NE, E},
- [4]int8{E, E, SE, SW},
- [4]int8{E, E, SW, SE},
- [4]int8{SE, E, NE, S},
- [4]int8{E, E, SW, E},
- [4]int8{E, SE, SE, NE},
- [4]int8{E, SE, SE, W},
- [4]int8{E, SE, E, E},
- [4]int8{E, E, E, SW},
-}
-
-/* To minimize the amount of work done in the recursive solve function below,
- * I'm going to allocate enough space for all legal rotations of each piece
- * at each position on the board. That's 10 pieces x 50 board positions x
- * 12 rotations. However, not all 12 rotations will fit on every cell, so
- * I'll have to keep count of the actual number that do.
- * The pieces are going to be unsigned long long ints just like the board so
- * they can be bitwise-anded with the board to determine if they fit.
- * I'm also going to record the next possible open cell for each piece and
- * location to reduce the burden on the solve function.
- */
-var (
- pieces [10][50][12]uint64
- piece_counts [10][50]int
- next_cell [10][50][12]int8
-)
-
-/* Returns the direction rotated 60 degrees clockwise */
-func rotate(dir int8) int8 { return (dir + 2) % PIVOT }
-
-/* Returns the direction flipped on the horizontal axis */
-func flip(dir int8) int8 { return (PIVOT - dir) % PIVOT }
-
-/* Returns the new cell index from the specified cell in the
- * specified direction. The index is only valid if the
- * starting cell and direction have been checked by the
- * out_of_bounds function first.
- */
-func shift(cell, dir int8) int8 {
- switch dir {
- case E:
- return cell + 1
- case ESE:
- if ((cell / 5) % 2) != 0 {
- return cell + 7
- } else {
- return cell + 6
- }
- case SE:
- if ((cell / 5) % 2) != 0 {
- return cell + 6
- } else {
- return cell + 5
- }
- case S:
- return cell + 10
- case SW:
- if ((cell / 5) % 2) != 0 {
- return cell + 5
- } else {
- return cell + 4
- }
- case WSW:
- if ((cell / 5) % 2) != 0 {
- return cell + 4
- } else {
- return cell + 3
- }
- case W:
- return cell - 1
- case WNW:
- if ((cell / 5) % 2) != 0 {
- return cell - 6
- } else {
- return cell - 7
- }
- case NW:
- if ((cell / 5) % 2) != 0 {
- return cell - 5
- } else {
- return cell - 6
- }
- case N:
- return cell - 10
- case NE:
- if ((cell / 5) % 2) != 0 {
- return cell - 4
- } else {
- return cell - 5
- }
- case ENE:
- if ((cell / 5) % 2) != 0 {
- return cell - 3
- } else {
- return cell - 4
- }
- }
- return cell
-}
-
-/* Returns wether the specified cell and direction will land outside
- * of the board. Used to determine if a piece is at a legal board
- * location or not.
- */
-func out_of_bounds(cell, dir int8) bool {
- switch dir {
- case E:
- return cell%5 == 4
- case ESE:
- i := cell % 10
- return i == 4 || i == 8 || i == 9 || cell >= 45
- case SE:
- return cell%10 == 9 || cell >= 45
- case S:
- return cell >= 40
- case SW:
- return cell%10 == 0 || cell >= 45
- case WSW:
- i := cell % 10
- return i == 0 || i == 1 || i == 5 || cell >= 45
- case W:
- return cell%5 == 0
- case WNW:
- i := cell % 10
- return i == 0 || i == 1 || i == 5 || cell < 5
- case NW:
- return cell%10 == 0 || cell < 5
- case N:
- return cell < 10
- case NE:
- return cell%10 == 9 || cell < 5
- case ENE:
- i := cell % 10
- return i == 4 || i == 8 || i == 9 || cell < 5
- }
- return false
-}
-
-/* Rotate a piece 60 degrees clockwise */
-func rotate_piece(piece int) {
- for i := 0; i < 4; i++ {
- piece_def[piece][i] = rotate(piece_def[piece][i])
- }
-}
-
-/* Flip a piece along the horizontal axis */
-func flip_piece(piece int) {
- for i := 0; i < 4; i++ {
- piece_def[piece][i] = flip(piece_def[piece][i])
- }
-}
-
-/* Convenience function to quickly calculate all of the indices for a piece */
-func calc_cell_indices(cell []int8, piece int, index int8) {
- cell[0] = index
- for i := 1; i < 5; i++ {
- cell[i] = shift(cell[i-1], piece_def[piece][i-1])
- }
-}
-
-/* Convenience function to quickly calculate if a piece fits on the board */
-func cells_fit_on_board(cell []int8, piece int) bool {
- return !out_of_bounds(cell[0], piece_def[piece][0]) &&
- !out_of_bounds(cell[1], piece_def[piece][1]) &&
- !out_of_bounds(cell[2], piece_def[piece][2]) &&
- !out_of_bounds(cell[3], piece_def[piece][3])
-}
-
-/* Returns the lowest index of the cells of a piece.
- * I use the lowest index that a piece occupies as the index for looking up
- * the piece in the solve function.
- */
-func minimum_of_cells(cell []int8) int8 {
- minimum := cell[0]
- for i := 1; i < 5; i++ {
- if cell[i] < minimum {
- minimum = cell[i]
- }
- }
- return minimum
-}
-
-/* Calculate the lowest possible open cell if the piece is placed on the board.
- * Used to later reduce the amount of time searching for open cells in the
- * solve function.
- */
-func first_empty_cell(cell []int8, minimum int8) int8 {
- first_empty := minimum
- for first_empty == cell[0] || first_empty == cell[1] ||
- first_empty == cell[2] || first_empty == cell[3] ||
- first_empty == cell[4] {
- first_empty++
- }
- return first_empty
-}
-
-/* Generate the unsigned long long int that will later be anded with the
- * board to determine if it fits.
- */
-func bitmask_from_cells(cell []int8) uint64 {
- var piece_mask uint64
- for i := 0; i < 5; i++ {
- piece_mask |= 1 << uint(cell[i])
- }
- return piece_mask
-}
-
-/* Record the piece and other important information in arrays that will
- * later be used by the solve function.
- */
-func record_piece(piece int, minimum int8, first_empty int8, piece_mask uint64) {
- pieces[piece][minimum][piece_counts[piece][minimum]] = piece_mask
- next_cell[piece][minimum][piece_counts[piece][minimum]] = first_empty
- piece_counts[piece][minimum]++
-}
-
-/* Fill the entire board going cell by cell. If any cells are "trapped"
- * they will be left alone.
- */
-func fill_contiguous_space(board []int8, index int8) {
- if board[index] == 1 {
- return
- }
- board[index] = 1
- if !out_of_bounds(index, E) {
- fill_contiguous_space(board, shift(index, E))
- }
- if !out_of_bounds(index, SE) {
- fill_contiguous_space(board, shift(index, SE))
- }
- if !out_of_bounds(index, SW) {
- fill_contiguous_space(board, shift(index, SW))
- }
- if !out_of_bounds(index, W) {
- fill_contiguous_space(board, shift(index, W))
- }
- if !out_of_bounds(index, NW) {
- fill_contiguous_space(board, shift(index, NW))
- }
- if !out_of_bounds(index, NE) {
- fill_contiguous_space(board, shift(index, NE))
- }
-}
-
-/* To thin the number of pieces, I calculate if any of them trap any empty
- * cells at the edges. There are only a handful of exceptions where the
- * the board can be solved with the trapped cells. For example: piece 8 can
- * trap 5 cells in the corner, but piece 3 can fit in those cells, or piece 0
- * can split the board in half where both halves are viable.
- */
-func has_island(cell []int8, piece int) bool {
- temp_board := make([]int8, 50)
- var i int
- for i = 0; i < 5; i++ {
- temp_board[cell[i]] = 1
- }
- i = 49
- for temp_board[i] == 1 {
- i--
- }
- fill_contiguous_space(temp_board, int8(i))
- c := 0
- for i = 0; i < 50; i++ {
- if temp_board[i] == 0 {
- c++
- }
- }
- if c == 0 || (c == 5 && piece == 8) || (c == 40 && piece == 8) ||
- (c%5 == 0 && piece == 0) {
- return false
- }
- return true
-}
-
-/* Calculate all six rotations of the specified piece at the specified index.
- * We calculate only half of piece 3's rotations. This is because any solution
- * found has an identical solution rotated 180 degrees. Thus we can reduce the
- * number of attempted pieces in the solve algorithm by not including the 180-
- * degree-rotated pieces of ONE of the pieces. I chose piece 3 because it gave
- * me the best time ;)
- */
-func calc_six_rotations(piece, index int) {
- cell := make([]int8, 5)
- for rotation := 0; rotation < 6; rotation++ {
- if piece != 3 || rotation < 3 {
- calc_cell_indices(cell, piece, int8(index))
- if cells_fit_on_board(cell, piece) && !has_island(cell, piece) {
- minimum := minimum_of_cells(cell)
- first_empty := first_empty_cell(cell, minimum)
- piece_mask := bitmask_from_cells(cell)
- record_piece(piece, minimum, first_empty, piece_mask)
- }
- }
- rotate_piece(piece)
- }
-}
-
-/* Calculate every legal rotation for each piece at each board location. */
-func calc_pieces() {
- for piece := 0; piece < 10; piece++ {
- for index := 0; index < 50; index++ {
- calc_six_rotations(piece, index)
- flip_piece(piece)
- calc_six_rotations(piece, index)
- }
- }
-}
-
-/* Calculate all 32 possible states for a 5-bit row and all rows that will
- * create islands that follow any of the 32 possible rows. These pre-
- * calculated 5-bit rows will be used to find islands in a partially solved
- * board in the solve function.
- */
-const (
- ROW_MASK = 0x1F
- TRIPLE_MASK = 0x7FFF
-)
-
-var (
- all_rows = [32]int8{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- }
- bad_even_rows [32][32]int8
- bad_odd_rows [32][32]int8
- bad_even_triple [32768]int8
- bad_odd_triple [32768]int8
-)
-
-func rows_bad(row1, row2 int8, even bool) int8 {
- /* even is referring to row1 */
- var row2_shift int8
- /* Test for blockages at same index and shifted index */
- if even {
- row2_shift = ((row2 << 1) & ROW_MASK) | 0x01
- } else {
- row2_shift = (row2 >> 1) | 0x10
- }
- block := ((row1 ^ row2) & row2) & ((row1 ^ row2_shift) & row2_shift)
- /* Test for groups of 0's */
- in_zeroes := false
- group_okay := false
- for i := uint8(0); i < 5; i++ {
- if row1&(1<<i) != 0 {
- if in_zeroes {
- if !group_okay {
- return 1
- }
- in_zeroes = false
- group_okay = false
- }
- } else {
- if !in_zeroes {
- in_zeroes = true
- }
- if (block & (1 << i)) == 0 {
- group_okay = true
- }
- }
- }
- if in_zeroes {
- return boolInt(!group_okay)
- }
- return 0
-}
-
-/* Check for cases where three rows checked sequentially cause a false
- * positive. One scenario is when 5 cells may be surrounded where piece 5
- * or 7 can fit. The other scenario is when piece 2 creates a hook shape.
- */
-func triple_is_okay(row1, row2, row3 int, even bool) bool {
- if even {
- /* There are four cases:
- * row1: 00011 00001 11001 10101
- * row2: 01011 00101 10001 10001
- * row3: 011?? 00110 ????? ?????
- */
- return ((row1 == 0x03) && (row2 == 0x0B) && ((row3 & 0x1C) == 0x0C)) ||
- ((row1 == 0x01) && (row2 == 0x05) && (row3 == 0x06)) ||
- ((row1 == 0x19) && (row2 == 0x11)) ||
- ((row1 == 0x15) && (row2 == 0x11))
- }
- /* There are two cases:
- * row1: 10011 10101
- * row2: 10001 10001
- * row3: ????? ?????
- */
- return ((row1 == 0x13) && (row2 == 0x11)) ||
- ((row1 == 0x15) && (row2 == 0x11))
-}
-
-func calc_rows() {
- for row1 := int8(0); row1 < 32; row1++ {
- for row2 := int8(0); row2 < 32; row2++ {
- bad_even_rows[row1][row2] = rows_bad(row1, row2, true)
- bad_odd_rows[row1][row2] = rows_bad(row1, row2, false)
- }
- }
- for row1 := 0; row1 < 32; row1++ {
- for row2 := 0; row2 < 32; row2++ {
- for row3 := 0; row3 < 32; row3++ {
- result1 := bad_even_rows[row1][row2]
- result2 := bad_odd_rows[row2][row3]
- if result1 == 0 && result2 != 0 && triple_is_okay(row1, row2, row3, true) {
- bad_even_triple[row1+(row2*32)+(row3*1024)] = 0
- } else {
- bad_even_triple[row1+(row2*32)+(row3*1024)] = boolInt(result1 != 0 || result2 != 0)
- }
-
- result1 = bad_odd_rows[row1][row2]
- result2 = bad_even_rows[row2][row3]
- if result1 == 0 && result2 != 0 && triple_is_okay(row1, row2, row3, false) {
- bad_odd_triple[row1+(row2*32)+(row3*1024)] = 0
- } else {
- bad_odd_triple[row1+(row2*32)+(row3*1024)] = boolInt(result1 != 0 || result2 != 0)
- }
- }
- }
- }
-}
-
-/* Calculate islands while solving the board.
- */
-func boardHasIslands(cell int8) int8 {
- /* Too low on board, don't bother checking */
- if cell >= 40 {
- return 0
- }
- current_triple := (board >> uint((cell/5)*5)) & TRIPLE_MASK
- if (cell/5)%2 != 0 {
- return bad_odd_triple[current_triple]
- }
- return bad_even_triple[current_triple]
-}
-
-/* The recursive solve algorithm. Try to place each permutation in the upper-
- * leftmost empty cell. Mark off available pieces as it goes along.
- * Because the board is a bit mask, the piece number and bit mask must be saved
- * at each successful piece placement. This data is used to create a 50 char
- * array if a solution is found.
- */
-var (
- avail uint16 = 0x03FF
- sol_nums [10]int8
- sol_masks [10]uint64
- solutions [2100][50]int8
- solution_count = 0
-)
-
-func record_solution() {
- for sol_no := 0; sol_no < 10; sol_no++ {
- sol_mask := sol_masks[sol_no]
- for index := 0; index < 50; index++ {
- if sol_mask&1 == 1 {
- solutions[solution_count][index] = sol_nums[sol_no]
- /* Board rotated 180 degrees is a solution too! */
- solutions[solution_count+1][49-index] = sol_nums[sol_no]
- }
- sol_mask = sol_mask >> 1
- }
- }
- solution_count += 2
-}
-
-func solve(depth, cell int8) {
- if solution_count >= *max_solutions {
- return
- }
-
- for board&(1<<uint(cell)) != 0 {
- cell++
- }
-
- for piece := int8(0); piece < 10; piece++ {
- var piece_no_mask uint16 = 1 << uint(piece)
- if avail&piece_no_mask == 0 {
- continue
- }
- avail ^= piece_no_mask
- max_rots := piece_counts[piece][cell]
- piece_mask := pieces[piece][cell]
- for rotation := 0; rotation < max_rots; rotation++ {
- if board&piece_mask[rotation] == 0 {
- sol_nums[depth] = piece
- sol_masks[depth] = piece_mask[rotation]
- if depth == 9 {
- /* Solution found!!!!!11!!ONE! */
- record_solution()
- avail ^= piece_no_mask
- return
- }
- board |= piece_mask[rotation]
- if boardHasIslands(next_cell[piece][cell][rotation]) == 0 {
- solve(depth+1, next_cell[piece][cell][rotation])
- }
- board ^= piece_mask[rotation]
- }
- }
- avail ^= piece_no_mask
- }
-}
-
-/* pretty print a board in the specified hexagonal format */
-func pretty(b *[50]int8) {
- for i := 0; i < 50; i += 10 {
- fmt.Printf("%c %c %c %c %c \n %c %c %c %c %c \n", b[i]+'0', b[i+1]+'0',
- b[i+2]+'0', b[i+3]+'0', b[i+4]+'0', b[i+5]+'0', b[i+6]+'0',
- b[i+7]+'0', b[i+8]+'0', b[i+9]+'0')
- }
- fmt.Printf("\n")
-}
-
-/* Find smallest and largest solutions */
-func smallest_largest() (smallest, largest *[50]int8) {
- smallest = &solutions[0]
- largest = &solutions[0]
- for i := 1; i < solution_count; i++ {
- candidate := &solutions[i]
- for j, s := range *smallest {
- c := candidate[j]
- if c == s {
- continue
- }
- if c < s {
- smallest = candidate
- }
- break
- }
- for j, s := range *largest {
- c := candidate[j]
- if c == s {
- continue
- }
- if c > s {
- largest = candidate
- }
- break
- }
- }
- return
-}
-
-func main() {
- flag.Parse()
- calc_pieces()
- calc_rows()
- solve(0, 0)
- fmt.Printf("%d solutions found\n\n", solution_count)
- smallest, largest := smallest_largest()
- pretty(smallest)
- pretty(largest)
-}
diff --git a/test/bench/shootout/meteor-contest.txt b/test/bench/shootout/meteor-contest.txt
deleted file mode 100644
index 38d9783..0000000
--- a/test/bench/shootout/meteor-contest.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-2098 solutions found
-
-0 0 0 0 1
- 2 2 2 0 1
-2 6 6 1 1
- 2 6 1 5 5
-8 6 5 5 5
- 8 6 3 3 3
-4 8 8 9 3
- 4 4 8 9 3
-4 7 4 7 9
- 7 7 7 9 9
-
-9 9 9 9 8
- 9 6 6 8 5
-6 6 8 8 5
- 6 8 2 5 5
-7 7 7 2 5
- 7 4 7 2 0
-1 4 2 2 0
- 1 4 4 0 3
-1 4 0 0 3
- 1 1 3 3 3
-
diff --git a/test/bench/shootout/nbody.c b/test/bench/shootout/nbody.c
deleted file mode 100644
index 3b95b05..0000000
--- a/test/bench/shootout/nbody.c
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * The Great Computer Language Shootout
- * http://shootout.alioth.debian.org/
- *
- * contributed by Christoph Bauer
- *
- */
-
-#include <math.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#define pi 3.141592653589793
-#define solar_mass (4 * pi * pi)
-#define days_per_year 365.24
-
-struct planet {
- double x, y, z;
- double vx, vy, vz;
- double mass;
-};
-
-void advance(int nbodies, struct planet * bodies, double dt)
-{
- int i, j;
-
- for (i = 0; i < nbodies; i++) {
- struct planet * b = &(bodies[i]);
- for (j = i + 1; j < nbodies; j++) {
- struct planet * b2 = &(bodies[j]);
- double dx = b->x - b2->x;
- double dy = b->y - b2->y;
- double dz = b->z - b2->z;
- double distance = sqrt(dx * dx + dy * dy + dz * dz);
- double mag = dt / (distance * distance * distance);
- b->vx -= dx * b2->mass * mag;
- b->vy -= dy * b2->mass * mag;
- b->vz -= dz * b2->mass * mag;
- b2->vx += dx * b->mass * mag;
- b2->vy += dy * b->mass * mag;
- b2->vz += dz * b->mass * mag;
- }
- }
- for (i = 0; i < nbodies; i++) {
- struct planet * b = &(bodies[i]);
- b->x += dt * b->vx;
- b->y += dt * b->vy;
- b->z += dt * b->vz;
- }
-}
-
-double energy(int nbodies, struct planet * bodies)
-{
- double e;
- int i, j;
-
- e = 0.0;
- for (i = 0; i < nbodies; i++) {
- struct planet * b = &(bodies[i]);
- e += 0.5 * b->mass * (b->vx * b->vx + b->vy * b->vy + b->vz * b->vz);
- for (j = i + 1; j < nbodies; j++) {
- struct planet * b2 = &(bodies[j]);
- double dx = b->x - b2->x;
- double dy = b->y - b2->y;
- double dz = b->z - b2->z;
- double distance = sqrt(dx * dx + dy * dy + dz * dz);
- e -= (b->mass * b2->mass) / distance;
- }
- }
- return e;
-}
-
-void offset_momentum(int nbodies, struct planet * bodies)
-{
- double px = 0.0, py = 0.0, pz = 0.0;
- int i;
- for (i = 0; i < nbodies; i++) {
- px += bodies[i].vx * bodies[i].mass;
- py += bodies[i].vy * bodies[i].mass;
- pz += bodies[i].vz * bodies[i].mass;
- }
- bodies[0].vx = - px / solar_mass;
- bodies[0].vy = - py / solar_mass;
- bodies[0].vz = - pz / solar_mass;
-}
-
-#define NBODIES 5
-struct planet bodies[NBODIES] = {
- { /* sun */
- 0, 0, 0, 0, 0, 0, solar_mass
- },
- { /* jupiter */
- 4.84143144246472090e+00,
- -1.16032004402742839e+00,
- -1.03622044471123109e-01,
- 1.66007664274403694e-03 * days_per_year,
- 7.69901118419740425e-03 * days_per_year,
- -6.90460016972063023e-05 * days_per_year,
- 9.54791938424326609e-04 * solar_mass
- },
- { /* saturn */
- 8.34336671824457987e+00,
- 4.12479856412430479e+00,
- -4.03523417114321381e-01,
- -2.76742510726862411e-03 * days_per_year,
- 4.99852801234917238e-03 * days_per_year,
- 2.30417297573763929e-05 * days_per_year,
- 2.85885980666130812e-04 * solar_mass
- },
- { /* uranus */
- 1.28943695621391310e+01,
- -1.51111514016986312e+01,
- -2.23307578892655734e-01,
- 2.96460137564761618e-03 * days_per_year,
- 2.37847173959480950e-03 * days_per_year,
- -2.96589568540237556e-05 * days_per_year,
- 4.36624404335156298e-05 * solar_mass
- },
- { /* neptune */
- 1.53796971148509165e+01,
- -2.59193146099879641e+01,
- 1.79258772950371181e-01,
- 2.68067772490389322e-03 * days_per_year,
- 1.62824170038242295e-03 * days_per_year,
- -9.51592254519715870e-05 * days_per_year,
- 5.15138902046611451e-05 * solar_mass
- }
-};
-
-int main(int argc, char ** argv)
-{
- int n = atoi(argv[1]);
- int i;
-
- offset_momentum(NBODIES, bodies);
- printf ("%.9f\n", energy(NBODIES, bodies));
- for (i = 1; i <= n; i++)
- advance(NBODIES, bodies, 0.01);
- printf ("%.9f\n", energy(NBODIES, bodies));
- return 0;
-}
diff --git a/test/bench/shootout/nbody.go b/test/bench/shootout/nbody.go
deleted file mode 100644
index 988f3ba..0000000
--- a/test/bench/shootout/nbody.go
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * based on C program by Christoph Bauer
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "math"
-)
-
-var n = flag.Int("n", 1000, "number of iterations")
-
-type Body struct {
- x, y, z, vx, vy, vz, mass float64
-}
-
-const (
- solarMass = 4 * math.Pi * math.Pi
- daysPerYear = 365.24
-)
-
-func (b *Body) offsetMomentum(px, py, pz float64) {
- b.vx = -px / solarMass
- b.vy = -py / solarMass
- b.vz = -pz / solarMass
-}
-
-type System []*Body
-
-func NewSystem(body []Body) System {
- n := make(System, len(body))
- for i := 0; i < len(body); i++ {
- n[i] = new(Body) // copy to avoid overwriting the inputs
- *n[i] = body[i]
- }
- var px, py, pz float64
- for _, body := range n {
- px += body.vx * body.mass
- py += body.vy * body.mass
- pz += body.vz * body.mass
- }
- n[0].offsetMomentum(px, py, pz)
- return n
-}
-
-func (sys System) energy() float64 {
- var e float64
- for i, body := range sys {
- e += 0.5 * body.mass *
- (body.vx*body.vx + body.vy*body.vy + body.vz*body.vz)
- for j := i + 1; j < len(sys); j++ {
- body2 := sys[j]
- dx := body.x - body2.x
- dy := body.y - body2.y
- dz := body.z - body2.z
- distance := math.Sqrt(dx*dx + dy*dy + dz*dz)
- e -= (body.mass * body2.mass) / distance
- }
- }
- return e
-}
-
-func (sys System) advance(dt float64) {
- for i, body := range sys {
- for j := i + 1; j < len(sys); j++ {
- body2 := sys[j]
- dx := body.x - body2.x
- dy := body.y - body2.y
- dz := body.z - body2.z
-
- dSquared := dx*dx + dy*dy + dz*dz
- distance := math.Sqrt(dSquared)
- mag := dt / (dSquared * distance)
-
- body.vx -= dx * body2.mass * mag
- body.vy -= dy * body2.mass * mag
- body.vz -= dz * body2.mass * mag
-
- body2.vx += dx * body.mass * mag
- body2.vy += dy * body.mass * mag
- body2.vz += dz * body.mass * mag
- }
- }
-
- for _, body := range sys {
- body.x += dt * body.vx
- body.y += dt * body.vy
- body.z += dt * body.vz
- }
-}
-
-var (
- jupiter = Body{
- x: 4.84143144246472090e+00,
- y: -1.16032004402742839e+00,
- z: -1.03622044471123109e-01,
- vx: 1.66007664274403694e-03 * daysPerYear,
- vy: 7.69901118419740425e-03 * daysPerYear,
- vz: -6.90460016972063023e-05 * daysPerYear,
- mass: 9.54791938424326609e-04 * solarMass,
- }
- saturn = Body{
- x: 8.34336671824457987e+00,
- y: 4.12479856412430479e+00,
- z: -4.03523417114321381e-01,
- vx: -2.76742510726862411e-03 * daysPerYear,
- vy: 4.99852801234917238e-03 * daysPerYear,
- vz: 2.30417297573763929e-05 * daysPerYear,
- mass: 2.85885980666130812e-04 * solarMass,
- }
- uranus = Body{
- x: 1.28943695621391310e+01,
- y: -1.51111514016986312e+01,
- z: -2.23307578892655734e-01,
- vx: 2.96460137564761618e-03 * daysPerYear,
- vy: 2.37847173959480950e-03 * daysPerYear,
- vz: -2.96589568540237556e-05 * daysPerYear,
- mass: 4.36624404335156298e-05 * solarMass,
- }
- neptune = Body{
- x: 1.53796971148509165e+01,
- y: -2.59193146099879641e+01,
- z: 1.79258772950371181e-01,
- vx: 2.68067772490389322e-03 * daysPerYear,
- vy: 1.62824170038242295e-03 * daysPerYear,
- vz: -9.51592254519715870e-05 * daysPerYear,
- mass: 5.15138902046611451e-05 * solarMass,
- }
- sun = Body{
- mass: solarMass,
- }
-)
-
-func main() {
- flag.Parse()
-
- system := NewSystem([]Body{sun, jupiter, saturn, uranus, neptune})
- fmt.Printf("%.9f\n", system.energy())
- for i := 0; i < *n; i++ {
- system.advance(0.01)
- }
- fmt.Printf("%.9f\n", system.energy())
-}
diff --git a/test/bench/shootout/nbody.txt b/test/bench/shootout/nbody.txt
deleted file mode 100644
index 1731557..0000000
--- a/test/bench/shootout/nbody.txt
+++ /dev/null
@@ -1,2 +0,0 @@
--0.169075164
--0.169087605
diff --git a/test/bench/shootout/pidigits.c b/test/bench/shootout/pidigits.c
deleted file mode 100644
index c064da0..0000000
--- a/test/bench/shootout/pidigits.c
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- http://shootout.alioth.debian.org/
-
- contributed by Paolo Bonzini & Sean Bartlett
- modified by Michael Mellor
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <gmp.h>
-
-static mpz_t numer, accum, denom, tmp1, tmp2;
-
-static int extract_digit()
-{
- if (mpz_cmp(numer, accum) > 0)
- return -1;
-
- /* Compute (numer * 3 + accum) / denom */
- mpz_mul_2exp(tmp1, numer, 1);
- mpz_add(tmp1, tmp1, numer);
- mpz_add(tmp1, tmp1, accum);
- mpz_fdiv_qr(tmp1, tmp2, tmp1, denom);
-
- /* Now, if (numer * 4 + accum) % denom... */
- mpz_add(tmp2, tmp2, numer);
-
- /* ... is normalized, then the two divisions have the same result. */
- if (mpz_cmp(tmp2, denom) >= 0)
- return -1;
-
- return mpz_get_ui(tmp1);
-}
-
-static void next_term(unsigned int k)
-{
- unsigned int y2 = k*2 + 1;
-
- mpz_mul_2exp(tmp1, numer, 1);
- mpz_add(accum, accum, tmp1);
- mpz_mul_ui(accum, accum, y2);
- mpz_mul_ui(numer, numer, k);
- mpz_mul_ui(denom, denom, y2);
-}
-
-static void eliminate_digit(unsigned int d)
-{
- mpz_submul_ui(accum, denom, d);
- mpz_mul_ui(accum, accum, 10);
- mpz_mul_ui(numer, numer, 10);
-}
-
-static void pidigits(unsigned int n)
-{
- int d;
- unsigned int i = 0, k = 0, m;
- mpz_init(tmp1);
- mpz_init(tmp2);
- mpz_init_set_ui(numer, 1);
- mpz_init_set_ui(accum, 0);
- mpz_init_set_ui(denom, 1);
-
- for(;;)
- {
- do {
- k++;
- next_term(k);
- d = extract_digit();
- } while(d == -1);
-
- putchar(d + '0');
-
- i++;
- m = i%10;
- if(m == 0)
- printf("\t:%d\n", i);
- if(i >= n)
- break;
- eliminate_digit(d);
- }
-
- if(m) {
- m = 10 - m;
- while(m--)
- putchar(' ');
- printf("\t:%d\n", n);
- }
-}
-
-int main(int argc, char **argv)
-{
- pidigits(argc > 1 ? atoi(argv[1]) : 27);
- return 0;
-}
diff --git a/test/bench/shootout/pidigits.go b/test/bench/shootout/pidigits.go
deleted file mode 100644
index a0f21a9..0000000
--- a/test/bench/shootout/pidigits.go
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * based on pidigits.c (by Paolo Bonzini & Sean Bartlett,
- * modified by Michael Mellor)
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "math/big"
-)
-
-var n = flag.Int("n", 27, "number of digits")
-var silent = flag.Bool("s", false, "don't print result")
-
-var (
- tmp1 = big.NewInt(0)
- tmp2 = big.NewInt(0)
- tmp3 = big.NewInt(0)
- y2 = big.NewInt(0)
- bigk = big.NewInt(0)
- numer = big.NewInt(1)
- accum = big.NewInt(0)
- denom = big.NewInt(1)
- ten = big.NewInt(10)
-)
-
-func extract_digit() int64 {
- if numer.Cmp(accum) > 0 {
- return -1
- }
-
- // Compute (numer * 3 + accum) / denom
- tmp1.Lsh(numer, 1)
- tmp1.Add(tmp1, numer)
- tmp1.Add(tmp1, accum)
- tmp1.DivMod(tmp1, denom, tmp2)
-
- // Now, if (numer * 4 + accum) % denom...
- tmp2.Add(tmp2, numer)
-
- // ... is normalized, then the two divisions have the same result.
- if tmp2.Cmp(denom) >= 0 {
- return -1
- }
-
- return tmp1.Int64()
-}
-
-func next_term(k int64) {
- y2.SetInt64(k*2 + 1)
- bigk.SetInt64(k)
-
- tmp1.Lsh(numer, 1)
- accum.Add(accum, tmp1)
- accum.Mul(accum, y2)
- numer.Mul(numer, bigk)
- denom.Mul(denom, y2)
-}
-
-func eliminate_digit(d int64) {
- tmp3.SetInt64(d)
- accum.Sub(accum, tmp3.Mul(denom, tmp3))
- accum.Mul(accum, ten)
- numer.Mul(numer, ten)
-}
-
-func printf(s string, arg ...interface{}) {
- if !*silent {
- fmt.Printf(s, arg...)
- }
-}
-
-func main() {
- flag.Parse()
-
- var m int // 0 <= m < 10
- for i, k := 0, int64(0); ; {
- d := int64(-1)
- for d < 0 {
- k++
- next_term(k)
- d = extract_digit()
- }
-
- printf("%c", d+'0')
-
- i++
- m = i % 10
- if m == 0 {
- printf("\t:%d\n", i)
- }
- if i >= *n {
- break
- }
- eliminate_digit(d)
- }
-
- if m > 0 {
- printf("%s\t:%d\n", " "[m:10], *n)
- }
-}
diff --git a/test/bench/shootout/pidigits.txt b/test/bench/shootout/pidigits.txt
deleted file mode 100644
index ad946a9..0000000
--- a/test/bench/shootout/pidigits.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-3141592653 :10
-5897932384 :20
-6264338 :27
diff --git a/test/bench/shootout/regex-dna-parallel.go b/test/bench/shootout/regex-dna-parallel.go
deleted file mode 100644
index 9c6d421..0000000
--- a/test/bench/shootout/regex-dna-parallel.go
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "regexp"
- "runtime"
-)
-
-var variants = []string{
- "agggtaaa|tttaccct",
- "[cgt]gggtaaa|tttaccc[acg]",
- "a[act]ggtaaa|tttacc[agt]t",
- "ag[act]gtaaa|tttac[agt]ct",
- "agg[act]taaa|ttta[agt]cct",
- "aggg[acg]aaa|ttt[cgt]ccct",
- "agggt[cgt]aa|tt[acg]accct",
- "agggta[cgt]a|t[acg]taccct",
- "agggtaa[cgt]|[acg]ttaccct",
-}
-
-type Subst struct {
- pat, repl string
-}
-
-var substs = []Subst{
- Subst{"B", "(c|g|t)"},
- Subst{"D", "(a|g|t)"},
- Subst{"H", "(a|c|t)"},
- Subst{"K", "(g|t)"},
- Subst{"M", "(a|c)"},
- Subst{"N", "(a|c|g|t)"},
- Subst{"R", "(a|g)"},
- Subst{"S", "(c|g)"},
- Subst{"V", "(a|c|g)"},
- Subst{"W", "(a|t)"},
- Subst{"Y", "(c|t)"},
-}
-
-func countMatches(pat string, bytes []byte) int {
- re := regexp.MustCompile(pat)
- n := 0
- for {
- e := re.FindIndex(bytes)
- if e == nil {
- break
- }
- n++
- bytes = bytes[e[1]:]
- }
- return n
-}
-
-func main() {
- runtime.GOMAXPROCS(4)
- bytes, err := ioutil.ReadAll(os.Stdin)
- if err != nil {
- fmt.Fprintf(os.Stderr, "can't read input: %s\n", err)
- os.Exit(2)
- }
- ilen := len(bytes)
- // Delete the comment lines and newlines
- bytes = regexp.MustCompile("(>[^\n]+)?\n").ReplaceAll(bytes, []byte{})
- clen := len(bytes)
-
- mresults := make([]chan int, len(variants))
- for i, s := range variants {
- ch := make(chan int)
- mresults[i] = ch
- go func(ss string) {
- ch <- countMatches(ss, bytes)
- }(s)
- }
-
- lenresult := make(chan int)
- bb := bytes
- go func() {
- for _, sub := range substs {
- bb = regexp.MustCompile(sub.pat).ReplaceAll(bb, []byte(sub.repl))
- }
- lenresult <- len(bb)
- }()
-
- for i, s := range variants {
- fmt.Printf("%s %d\n", s, <-mresults[i])
- }
- fmt.Printf("\n%d\n%d\n%d\n", ilen, clen, <-lenresult)
-}
diff --git a/test/bench/shootout/regex-dna-parallel.txt b/test/bench/shootout/regex-dna-parallel.txt
deleted file mode 100644
index e23e71f..0000000
--- a/test/bench/shootout/regex-dna-parallel.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-agggtaaa|tttaccct 1
-[cgt]gggtaaa|tttaccc[acg] 0
-a[act]ggtaaa|tttacc[agt]t 0
-ag[act]gtaaa|tttac[agt]ct 0
-agg[act]taaa|ttta[agt]cct 1
-aggg[acg]aaa|ttt[cgt]ccct 0
-agggt[cgt]aa|tt[acg]accct 0
-agggta[cgt]a|t[acg]taccct 0
-agggtaa[cgt]|[acg]ttaccct 2
-
-10245
-10000
-13348
diff --git a/test/bench/shootout/regex-dna.c b/test/bench/shootout/regex-dna.c
deleted file mode 100644
index 134f821..0000000
--- a/test/bench/shootout/regex-dna.c
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
-** The Computer Language Shootout
-** http://shootout.alioth.debian.org/
-** contributed by Mike Pall
-**
-** regex-dna benchmark using PCRE
-**
-** compile with:
-** gcc -O3 -fomit-frame-pointer -o regexdna regexdna.c -lpcre
-*/
-
-#define __USE_STRING_INLINES
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <pcre.h>
-
-typedef struct fbuf {
- char *buf;
- size_t size, len;
-} fbuf_t;
-
-static void fb_init(fbuf_t *b)
-{
- b->buf = NULL;
- b->len = b->size = 0;
-}
-
-static char *fb_need(fbuf_t *b, size_t need)
-{
- need += b->len;
- if (need > b->size) {
- if (b->size == 0) b->size = need;
- else while (need > b->size) b->size += b->size;
- if (!(b->buf = realloc(b->buf, b->size))) exit(1);
- }
- return b->buf+b->len;
-}
-
-#define FB_MINREAD (3<<16)
-
-/* Read all of a stdio stream into dst buffer. */
-static size_t fb_readall(fbuf_t *dst, FILE *fp)
-{
- char *dp;
- int n;
- for (dp = fb_need(dst, FB_MINREAD);
- (n = fread(dp, 1, dst->size-dst->len, fp)) > 0;
- dp = fb_need(dst, FB_MINREAD)) dst->len += n;
- if (ferror(fp)) exit(1);
- return dst->len;
-}
-
-/* Substitute pattern p with replacement r, copying from src to dst buffer. */
-static size_t fb_subst(fbuf_t *dst, fbuf_t *src, const char *p, const char *r)
-{
- pcre *re;
- pcre_extra *re_ex;
- const char *re_e;
- char *dp;
- int re_eo, m[3], pos, rlen, clen;
- if (!(re = pcre_compile(p, PCRE_CASELESS, &re_e, &re_eo, NULL))) exit(1);
- re_ex = pcre_study(re, 0, &re_e);
- for (dst->len = 0, rlen = strlen(r), pos = 0;
- pcre_exec(re, re_ex, src->buf, src->len, pos, 0, m, 3) >= 0;
- pos = m[1]) {
- clen = m[0]-pos;
- dp = fb_need(dst, clen+rlen);
- dst->len += clen+rlen;
- memcpy(dp, src->buf+pos, clen);
- memcpy(dp+clen, r, rlen);
- }
- clen = src->len-pos;
- dp = fb_need(dst, clen);
- dst->len += clen;
- memcpy(dp, src->buf+pos, clen);
- return dst->len;
-}
-
-/* Count all matches with pattern p in src buffer. */
-static int fb_countmatches(fbuf_t *src, const char *p)
-{
- pcre *re;
- pcre_extra *re_ex;
- const char *re_e;
- int re_eo, m[3], pos, count;
- if (!(re = pcre_compile(p, PCRE_CASELESS, &re_e, &re_eo, NULL))) exit(1);
- re_ex = pcre_study(re, 0, &re_e);
- for (count = 0, pos = 0;
- pcre_exec(re, re_ex, src->buf, src->len, pos, 0, m, 3) >= 0;
- pos = m[1]) count++;
- return count;
-}
-
-static const char *variants[] = {
- "agggtaaa|tttaccct", "[cgt]gggtaaa|tttaccc[acg]",
- "a[act]ggtaaa|tttacc[agt]t", "ag[act]gtaaa|tttac[agt]ct",
- "agg[act]taaa|ttta[agt]cct", "aggg[acg]aaa|ttt[cgt]ccct",
- "agggt[cgt]aa|tt[acg]accct", "agggta[cgt]a|t[acg]taccct",
- "agggtaa[cgt]|[acg]ttaccct", NULL
-};
-
-static const char *subst[] = {
- "B", "(c|g|t)", "D", "(a|g|t)", "H", "(a|c|t)", "K", "(g|t)",
- "M", "(a|c)", "N", "(a|c|g|t)", "R", "(a|g)", "S", "(c|g)",
- "V", "(a|c|g)", "W", "(a|t)", "Y", "(c|t)", NULL
-};
-
-int main(int argc, char **argv)
-{
- fbuf_t seq[2];
- const char **pp;
- size_t ilen, clen, slen;
- int flip;
- fb_init(&seq[0]);
- fb_init(&seq[1]);
- ilen = fb_readall(&seq[0], stdin);
- clen = fb_subst(&seq[1], &seq[0], ">.*|\n", "");
- for (pp = variants; *pp; pp++)
- printf("%s %d\n", *pp, fb_countmatches(&seq[1], *pp));
- for (slen = 0, flip = 1, pp = subst; *pp; pp += 2, flip = 1-flip)
- slen = fb_subst(&seq[1-flip], &seq[flip], *pp, pp[1]);
- printf("\n%zu\n%zu\n%zu\n", ilen, clen, slen);
- return 0;
-}
diff --git a/test/bench/shootout/regex-dna.go b/test/bench/shootout/regex-dna.go
deleted file mode 100644
index 042d7f2..0000000
--- a/test/bench/shootout/regex-dna.go
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "fmt"
- "io/ioutil"
- "os"
- "regexp"
-)
-
-var variants = []string{
- "agggtaaa|tttaccct",
- "[cgt]gggtaaa|tttaccc[acg]",
- "a[act]ggtaaa|tttacc[agt]t",
- "ag[act]gtaaa|tttac[agt]ct",
- "agg[act]taaa|ttta[agt]cct",
- "aggg[acg]aaa|ttt[cgt]ccct",
- "agggt[cgt]aa|tt[acg]accct",
- "agggta[cgt]a|t[acg]taccct",
- "agggtaa[cgt]|[acg]ttaccct",
-}
-
-type Subst struct {
- pat, repl string
-}
-
-var substs = []Subst{
- Subst{"B", "(c|g|t)"},
- Subst{"D", "(a|g|t)"},
- Subst{"H", "(a|c|t)"},
- Subst{"K", "(g|t)"},
- Subst{"M", "(a|c)"},
- Subst{"N", "(a|c|g|t)"},
- Subst{"R", "(a|g)"},
- Subst{"S", "(c|g)"},
- Subst{"V", "(a|c|g)"},
- Subst{"W", "(a|t)"},
- Subst{"Y", "(c|t)"},
-}
-
-func countMatches(pat string, bytes []byte) int {
- re := regexp.MustCompile(pat)
- n := 0
- for {
- e := re.FindIndex(bytes)
- if len(e) == 0 {
- break
- }
- n++
- bytes = bytes[e[1]:]
- }
- return n
-}
-
-func main() {
- bytes, err := ioutil.ReadAll(os.Stdin)
- if err != nil {
- fmt.Fprintf(os.Stderr, "can't read input: %s\n", err)
- os.Exit(2)
- }
- ilen := len(bytes)
- // Delete the comment lines and newlines
- bytes = regexp.MustCompile("(>[^\n]+)?\n").ReplaceAll(bytes, []byte{})
- clen := len(bytes)
- for _, s := range variants {
- fmt.Printf("%s %d\n", s, countMatches(s, bytes))
- }
- for _, sub := range substs {
- bytes = regexp.MustCompile(sub.pat).ReplaceAll(bytes, []byte(sub.repl))
- }
- fmt.Printf("\n%d\n%d\n%d\n", ilen, clen, len(bytes))
-}
diff --git a/test/bench/shootout/regex-dna.txt b/test/bench/shootout/regex-dna.txt
deleted file mode 100644
index e23e71f..0000000
--- a/test/bench/shootout/regex-dna.txt
+++ /dev/null
@@ -1,13 +0,0 @@
-agggtaaa|tttaccct 1
-[cgt]gggtaaa|tttaccc[acg] 0
-a[act]ggtaaa|tttacc[agt]t 0
-ag[act]gtaaa|tttac[agt]ct 0
-agg[act]taaa|ttta[agt]cct 1
-aggg[acg]aaa|ttt[cgt]ccct 0
-agggt[cgt]aa|tt[acg]accct 0
-agggta[cgt]a|t[acg]taccct 0
-agggtaa[cgt]|[acg]ttaccct 2
-
-10245
-10000
-13348
diff --git a/test/bench/shootout/reverse-complement.c b/test/bench/shootout/reverse-complement.c
deleted file mode 100644
index b34c846..0000000
--- a/test/bench/shootout/reverse-complement.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
- * The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org
- *
- * contributed by Bob W
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#define JBFSIZE 82 // line input buffer size
-#define QBFSIZE 5200 // output buffer initial size
-#define Z16 "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
-#define V32 "\0TVGH\0\0CD\0\0M\0KN\0\0\0YSA\0BW\0R\0\0\0\0\0\0"
-#define VALL Z16 Z16 Z16 Z16 V32 V32 Z16 Z16 Z16 Z16 Z16 Z16 Z16 Z16
-
-int errex(char *s, int n) { // error message+value, return 1
- fprintf(stderr,"\n*** Error: %s [%d]!\n", s, n);
- return 1;
-}
-
-int main () { // ***** main *****
- char *pj, *pq, *pr; // buffer pointers: inp,out,/out
- char *jjj = malloc(JBFSIZE); // allocate input line buffer
- char *qqq = malloc(QBFSIZE); // output buffer (dyn. size)
- char *pqstop = qqq+QBFSIZE; // end-of-buffer pointer
- char xtab[256] = VALL; // char conversion table
-
- if (!jjj || !qqq)
- return errex("Buffer allocation", !jjj + !qqq);
- pj = fgets(jjj,JBFSIZE,stdin); // fetch 1st line
- if (!pj)
- return errex("No input data",0);
- if (*jjj != '>')
- return errex("1st char not '>'", 0);
-
- while (pj) { // MAIN LOOP: process data
- fputs(jjj, stdout); // output ID line
-
- for (pq=qqq+1, pr=pqstop; ; pq++) { // LOOP: fill output buffer
- pj = fgets(jjj, JBFSIZE, stdin); // get line from stdin
- if (!pj || (*jjj=='>')) break; // EOF or new ID line
- if (pr <= (pq+61)) { // need to resize buffer
- char *newstop = pqstop + 12777888;
- char *newptr = realloc(qqq, newstop-qqq);
- if (!newptr)
- return errex("Out of memory", 0);
- if (newptr != qqq) { // new base: adj. pointers
- size_t x = newptr-qqq; // offset for pointer update
- pq+=x; pr+=x; qqq+=x;
- newstop+=x; pqstop+=x;
- }
- pr = __builtin_memmove(newstop-(pqstop-pr), pr, pqstop-pr);
- pqstop = newstop; // buffer resize complete
- }
- while (*pj) { // LOOP: conv. & revert line
- char c = xtab[(unsigned char)(*pj++)];
- if (c) // conversion valid
- *(--pr) = c;
- }
- }
-
- for (pq = qqq; pr<pqstop; ) { // LOOP: format output
- size_t x = (pqstop-pr)<60 ? pqstop-pr : 60;
- __builtin_memmove(pq,pr,x); // move line to free space
- pr+=x; pq+=x; *(pq++) = 0xA; // adjust pointers, add LF
- }
- fwrite(qqq, 1, pq-qqq, stdout); // output converted data
- }
- return 0;
-}
diff --git a/test/bench/shootout/reverse-complement.go b/test/bench/shootout/reverse-complement.go
deleted file mode 100644
index baa30ff..0000000
--- a/test/bench/shootout/reverse-complement.go
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "bufio"
- "os"
-)
-
-const lineSize = 60
-
-var complement = [256]uint8{
- 'A': 'T', 'a': 'T',
- 'C': 'G', 'c': 'G',
- 'G': 'C', 'g': 'C',
- 'T': 'A', 't': 'A',
- 'U': 'A', 'u': 'A',
- 'M': 'K', 'm': 'K',
- 'R': 'Y', 'r': 'Y',
- 'W': 'W', 'w': 'W',
- 'S': 'S', 's': 'S',
- 'Y': 'R', 'y': 'R',
- 'K': 'M', 'k': 'M',
- 'V': 'B', 'v': 'B',
- 'H': 'D', 'h': 'D',
- 'D': 'H', 'd': 'H',
- 'B': 'V', 'b': 'V',
- 'N': 'N', 'n': 'N',
-}
-
-func main() {
- in := bufio.NewReader(os.Stdin)
- buf := make([]byte, 1024*1024)
- line, err := in.ReadSlice('\n')
- for err == nil {
- os.Stdout.Write(line)
-
- // Accumulate reversed complement in buf[w:]
- nchar := 0
- w := len(buf)
- for {
- line, err = in.ReadSlice('\n')
- if err != nil || line[0] == '>' {
- break
- }
- line = line[0 : len(line)-1]
- nchar += len(line)
- if len(line)+nchar/60+128 >= w {
- nbuf := make([]byte, len(buf)*5)
- copy(nbuf[len(nbuf)-len(buf):], buf)
- w += len(nbuf) - len(buf)
- buf = nbuf
- }
-
- // This loop is the bottleneck.
- for _, c := range line {
- w--
- buf[w] = complement[c]
- }
- }
-
- // Copy down to beginning of buffer, inserting newlines.
- // The loop left room for the newlines and 128 bytes of padding.
- i := 0
- for j := w; j < len(buf); j += 60 {
- n := copy(buf[i:i+60], buf[j:])
- buf[i+n] = '\n'
- i += n + 1
- }
- os.Stdout.Write(buf[0:i])
- }
-}
diff --git a/test/bench/shootout/reverse-complement.txt b/test/bench/shootout/reverse-complement.txt
deleted file mode 100644
index 14d792a..0000000
--- a/test/bench/shootout/reverse-complement.txt
+++ /dev/null
@@ -1,171 +0,0 @@
->ONE Homo sapiens alu
-CGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAAC
-CTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACA
-GGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCAT
-GTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAA
-AGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTC
-TGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGG
-GTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACC
-ACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTG
-GTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTA
-CAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCT
-GGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTC
-TCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAAT
-TTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCGAACTCCT
-GACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCA
-CCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGC
-GCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCC
-TCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTA
-GTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGAT
-CCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCT
-TTTTGAGACGGAGTCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTC
-ACTGCAACCTCCGCCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTG
-GGATTACAGGCGCGCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGT
-TTCACCATGTTGGCCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGG
-CCTCCCAAAGTGCTGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAG
-TCTCGCTCTGTCGCCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCG
-CCTCCCGGGTTCAAGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGC
-GCGCCACCACGCCCGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGG
-CCAGGCTGGTCTCGAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGC
-TGGGATTACAGGCGTGAGCCACCGCGCCCGGCCTTTTTGAGACGGAGTCTCGCTCTGTCG
-CCCAGGCTGGAGTGCAGTGGCGCGATCTCGGCTCACTGCAACCTCCGCCTCCCGGGTTCA
-AGCGATTCTCCTGCCTCAGCCTCCCGAGTAGCTGGGATTACAGGCGCGCGCCACCACGCC
-CGGCTAATTTTTGTATTTTTAGTAGAGACGGGGTTTCACCATGTTGGCCAGGCTGGTCTC
-GAACTCCTGACCTCAGGTGATCCGCCCGCCTCGGCCTCCCAAAGTGCTGGGATTACAGGC
-GTGAGCCACCGCGCCCGGCC
->TWO IUB ambiguity codes
-TAGGDHACHATCRGTRGVTGAGWTATGYTGCTGTCABACDWVTRTAAGAVVAGATTTNDA
-GASMTCTGCATBYTTCAAKTTACMTATTACTTCATARGGYACMRTGTTTTYTATACVAAT
-TTCTAKGDACKADACTATATNTANTCGTTCACGBCGYSCBHTANGGTGATCGTAAAGTAA
-CTATBAAAAGATSTGWATBCSGAKHTTABBAACGTSYCATGCAAVATKTSKTASCGGAAT
-WVATTTNTCCTTCTTCTTDDAGTGGTTGGATACVGTTAYMTMTBTACTTTHAGCTAGBAA
-AAGAGKAAGTTRATWATCAGATTMDDTTTAAAVAAATATTKTCYTAAATTVCNKTTRACG
-ADTATATTTATGATSADSCAATAWAGCGRTAGTGTAAGTGACVGRADYGTGCTACHVSDT
-CTVCARCSYTTAATATARAAAATTTAATTTACDAATTGBACAGTAYAABATBTGCAGBVG
-TGATGGDCAAAATBNMSTTABKATTGGSTCCTAGBTTACTTGTTTAGTTTATHCGATSTA
-AAGTCGAKAAASTGTTTTAWAKCAGATATACTTTTMTTTTGBATAGAGGAGCMATGATRA
-AAGGNCAYDCCDDGAAAGTHGBTAATCKYTBTACBGTBCTTTTTGDTAASSWTAAWAARA
-TTGGCTAAGWGRADTYACATAGCTCBTAGATAWAGCAATNGTATMATGTTKMMAGTAWTC
-CCNTSGAAWATWCAAAAMACTGAADNTYGATNAATCCGAYWNCTAACGTTAGAGDTTTTC
-ATCTGGKRTAVGAABVCTGWGBTCTDVGKATTBTCTAAGGVADAAAVWTCTAGGGGAGGG
-TTAGAACAATTAAHTAATNAAATGCATKATCTAAYRTDTCAGSAYTTYHGATRTTWAVTA
-BGNTCDACAGBCCRCAGWCRTCABTGMMAWGMCTCAACCGATRTGBCAVAATCGTDWDAA
-CAYAWAATWCTGGTAHCCCTAAGATAACSCTTAGTGSAACAWTBGTCDTTDGACWDBAAC
-HTTTNGSKTYYAAYGGATNTGATTTAARTTAMBAATCTAAGTBTCATYTAACTTADTGTT
-TCGATACGAAHGGCYATATACCWDTKYATDCSHTDTCAAAATGTGBACTGSCCVGATGTA
-TCMMAGCCTTDAAABAATGAAGAGTAACTHATMGVTTAATAACCCGGTTVSANTGCAATT
-GTGAGATTTAMGTTTAMAAYGCTGACAYAAAAAGGCACAMYTAAGVGGCTGGAABVTACG
-GATTSTYGTBVAKTATWACCGTGTKAGTDTGTATGTTTAAAGGAAAAAGTAACATARAAA
-GGTYCAMNYAAABTATAGNTSATANAGTCATCCTATWADKAACTRGTMSACDGTATSAYT
-AAHSHGTAABYGACTYTATADTGSTATAGAGAAATCGNTAAAGGAAATCAGTTGTNCYMV
-TNACDRTATBNATATASTAGAAMSCGGGANRCKKMCAAACATTNAGTCTRMAATBMTACC
-CGTACTTCTBGDSYAATWGAAAATGACADDCHAKAAAYATATTKTTTTCACANACWAGAA
-AKATCCTTATTAYKHKCTAAACARTATTTTDATBTVWCYGCAATACTAGGKAAASTTDGA
-MGGCHTTHAATVCAHDRYAGGRCTATACGTCMAGAGAGCTBTHGNACARTCCBDCTAAGA
-GCGGCTTTARTAAAGAATCCNAGTAWBTGACTTGAATTACWTVACAGAAABCAATNAAAC
-CGTNTRANTTGAYCMAWBADTANABRGGTKTHTWTAGTTVCTMBKTAGMTVKCCAGCANT
-TVAGSWTTAGCCGCRHTTTCCTTHNTATTAAGAAGAATAGGMTRAARTCTABGTACDTTT
-TATAAVDHAHTATAGATCCTAGTAAGYTWATDWCATGAGGGATAGTAAMDMNGBASTWAM
-TSTATRBAYDABATGTATATYCGCACTGTTTTAACMCWBTATAWAGTATBTSTATVTTAR
-CCTMTTAAKADATCAACTAATYTSVTAKGDATTATGCKTCAYCAKAATACTTKAANGAGT
-ATTSDAGATCGGAAATACTTAAYAAVGTATMCGCTTGTGTDCTAATYTATTTTATTTWAA
-CAGWRCTATGTAGMTGTTTGTTYKTNGTTKTCAGAACNTRACCTACKTGSRATGTGGGGG
-CTGTCATTAAGTAAATNGSTTABCCCCTCGCAGCTCWHTCGCGAAGCAVATGCKACGHCA
-ACAKTTAATAACASAAADATTWNYTGTAATTGTTCGTMHACHTWATGTGCWTTTTGAAHY
-ACTTTGTAYAMSAAACTTAADAAATATAGTABMATATYAATGSGGTAGTTTGTGTBYGGT
-TWSGSVGWMATTDMTCCWWCABTCSVACAGBAATGTTKATBGTCAATAATCTTCTTAAAC
-ARVAATHAGYBWCTRWCABGTWWAATCTAAGTCASTAAAKTAAGVKBAATTBGABACGTA
-AGGTTAAATAAAAACTRMDTWBCTTTTTAATAAAAGATMGCCTACKAKNTBAGYRASTGT
-ASSTCGTHCGAAKTTATTATATTYTTTGTAGAACATGTCAAAACTWTWTHGKTCCYAATA
-AAGTGGAYTMCYTAARCSTAAATWAKTGAATTTRAGTCTSSATACGACWAKAASATDAAA
-TGYYACTSAACAAHAKTSHYARGASTATTATTHAGGYGGASTTTBGAKGATSANAACACD
-TRGSTTRAAAAAAAACAAGARTCVTAGTAAGATAWATGVHAAKATWGAAAAGTYAHVTAC
-TCTGRTGTCAWGATRVAAKTCGCAAVCGASWGGTTRTCSAMCCTAACASGWKKAWDAATG
-ACRCBACTATGTGTCTTCAAAHGSCTATATTTCGTVWAGAAGTAYCKGARAKSGKAGTAN
-TTTCYACATWATGTCTAAAADMDTWCAATSTKDACAMAADADBSAAATAGGCTHAHAGTA
-CGACVGAATTATAAAGAHCCVAYHGHTTTACATSTTTATGNCCMTAGCATATGATAVAAG
->THREE Homo sapiens frequency
-ATATTTATCTTTTCACTTCCTACATTGGTCAGACCATTATTCGACACGTGGCGTCATTTT
-GTCATACCGGGTAATGTTGGAAACAAAACGTACTGATAAAATACTGAGTTGTAAACTCTA
-ATCAGATAACGCGCTTGGATATTAAGATTCACACAGGGGTTTCGGCTGTAAAAAAACTTG
-TGGAGCTGTTCTGGGACAGATAAGTTGTACCTCGTACTTAGCTAATTAATGAACCAACTG
-ATTACGATAGAACAATTCTGAGGCCGCCAGGACAGCCAAATTTTAATCTTATAAAGCTGG
-AAACAGCCGGTATTAGCTTCTCGCATACTTTGCCTGCATTGGTACCTTACAGATATCAGC
-GTAGTCATATACACCTCGGTCTCAGCTAAGCTTGTATCTCTTAGAGTAGTTCAAAGATAG
-TGGACAATACCTGTGGAATCGATTGCAGATATGGATTTATTTAACTACTGAGTCTCATTC
-ACAAGCTAAGCAAGGAGCACGTTTTGGTGCCGGCATACCGATTTGCTATCATGTCAGCAA
-ATTTGCGTTGTATTCCTAGTTGCACCCATTAAGGCCACACTCCGAACCTAATTATTACAT
-CGCAAAGACATGTACGAAGGACCCGATGTCGAATAGAAGGGAGGACTGTTCATTGGAAGC
-TAGACCAGAGGAATCGCAAAGATGCAACTCTTACAATAAAAATCTAATTTCAGTCAACAC
-GCAATTTCTATAAGGTTTCCGATAATAATGAACCGTCTTCCACAGGGGAATTTGCCATGC
-TCGTAAAAGTAGTTAATCCAAGTAGAAGAAATTTTGATAATGTTTTAAGTTGGCACGAAG
-GAATTCAGAGAGATCTTACCTAACAAAGGCATTAGTAGATGTTCCTTGGTTCACACTCGG
-TCAATCAGAGCACATACTACGGGCGATACCGGGAATGACACAACATCAATGAGATTGTTA
-AGTGAGGTAATTGACTTTAGAGGACTCGATCAGTATACTGTCACTATGAACATCGTATTA
-ATTGTTATCCGATATATACACCACCGATTTGCTTGTGCAAGGTTACAGACCCATTCGATA
-AATACAAACACGGAGCGATATTATTTAAGGAGTGCTGTCTTCAAAAGAATTATTCCCACA
-CCGACATAAGAACTTCGCTCCGTCATTCCAGATTTAAATAACATAACGTAACGCTTTGCT
-GATAACATAACATAACCGAGAATTTGCTTAGGAAATTTGGAGCAATATTGCATTGTTTCT
-CAGTCATCACAAGGCCCGCCAAAGAACTCTGAGAATCAGGATTCAACATGATTGGTAAGA
-CTCTATATATATAACTTAATTCTTGTGTCCGGAGATAGAAAGAGGACGAGAGATACTACG
-AAAGAAAGTGTACTTCGATGTATCAATTCAGACGCCTTCTCTATCATCAACATTATAGGT
-CTCGTATATGCTCGGCGCGATCTGCTTCTCTCCGCCAATAGCCCCATAGTGTATTTCAAG
-CGCAGTAACAGTGAAATCGTTACGAAGGTAGGGATGTTGCTTATAATTGTCGTAACTTAT
-CGCTTATGTATCTTTCAAGAATGAACGGCAGCATATACATACGTTCTACCTTTAGCTACA
-AAGCATCCATATACTCCCTCTCATGATTGAAACTCTTCCCTATTTTGTAGCCAATAGTGA
-AAGCGTATTAGTATAAATTCGTCGGTTTTTCACTCGCAACTGTTATACTCTGCAAACAAA
-CGAAAGCCTCATAGTACAAACCTAAAGCTACATACTTCATCATTGGCAGACCAGTGGCGG
-TATTTCTACGGAAGCATCACTATAGATATAAAGTTTCCCTTCATGTACGTCTGTTAACCA
-TATCACAAGAAACTGCTATCTCTGTCACGTAACAATTCACGCGCCTTATCGCCAAATGTT
-CATATATGCGCGGTATACGTATGAACGAATACTAATTAGTATAACGGAGGATTCACGGGA
-GGGATACTTGGGGCATTTATAAATCGTCTAAAAATTTTCTATCAGCACTTGCGGGTTATA
-GTGGATTACTAGGCAACATAATATTCTGTATTGGTCCAAATGACGCTATAGATAAATTAG
-CAAAATACATTGTTTCCATTTATGTAAGTCGAAACTCCAGGACTCCCGGGAACCAGTTAA
-ACCGTCTGGAAAAGACACATTGTGAGCGGGACTTCAATGATAGCTTTCAATGAGCTTCTC
-ATGCTTGGGGTCTGTACATATATGTTGGCGAAATTATCGTCTGTATTCTGTTATGCTTTG
-ATCATGGGTTATTAGTATAGTGTCCGGTTAAGTACCAATACCGCTAGAGACCCGACCTAA
-GTCGATAACTAACGATCATCGACGTAAGGATCGTCTCGATCAGTACTTCAGTCTAGATCT
-GGGAATAGTAACTCGTTAGTGAACTATGTCGTGTCATAACTCTAAAATGCAATCAAATCT
-TATTATTGAGTATTGATTATATAAAGCATCCGCTTAGCTTTACCCTCAAATGTTATATGC
-AATTTAAAGCGCTTGATATCGTCTACTCAAGTTCAGGTTTCACATGGCCGCAACGTGACG
-TTATTAGAGGTGGGTCATCATCTCTGAGGCTAGTGATGTTGAATACTCATTGAATGGGAA
-GTGGAATACCATGCTCGTAGGTAACAGCATGACCTATAAAATATACTATGGGTGTGTGGT
-AGATCAATATTGTTCAAGCATATCGTAACAATAACGGCTGAAATGTTACTGACATGAAAG
-AGGGAGTCCAAACCATTCTAACAGCTGATCAAGTCGTCTAAAAACGCCTGGTTCAGCCTT
-AAGAGTTATAAGCCAGACAAATTGTATCAATAGAGAATCCGTAAATTCCTCGGCCAACCT
-CTTGCAAAGACATCACTATCAATATACTACCGTGATCTTAATTAGTGAACTTATATAAAT
-ATCTACAACCAGATTCAACGGAAAAGCTTTAGTGGATTAGAAATTGCCAAGAATCACATT
-CATGTGGGTTCGAATGCTTTAGTAATACCATTTCGCCGAGTAGTCACTTCGCTGAACTGT
-CGTAAATTGCTATGACATAATCGAAAAGGATTGTCAAGAGTCGATTACTGCGGACTAATA
-ATCCCCACGGGGGTGGTCTCATGTCTCCCCAGGCGAGTGGGGACGGTTGATAAACACGCT
-GCATCGCGGACTGATGTTCCCAGTATTACATAGTCACATTGGATTGCGAGTAGTCTACCT
-ATTTATGAGCGAGAGATGCCTCTAACTACTTCGACTTTTAAAACCTTTCCACGCCAGTAT
-TCGGCGAAAGGGAAGTATTAAGGGTTGTCATAATTAAGCTGATACCACTTCAGACTTTGC
-TCTACTTCTGTCTTTCATTGGTTTAGTAAAGTCTGTCCATTCGTCGAGACCGTCTTTTGC
-AGCCTCATTCTACCAACTGCTCCGACTCTTAGTCTGCTTCTCCCAGCGTTATAACAAGAG
-GCATTTTGTCATCCTTAAAACAATAATAAAGAACTCGGAGCACTGATATAATGACTGAAT
-TAGAACCGCTTAAAAATACAACGAATAGATAAGACTATCGGATAAGATCTAATATGTAGT
-GATTAAGCCCTTTATTAATTAATAATAGTTACCCTTTCTGATGTAACGCGACATATTACG
-ATTTAGTGGCACGTCTGAATTGCAAAGCAGATCTCTACCCGATTTTTATTATAAATCCCG
-TATACATCTTGACTTGAGTAATTGTTCATCTTTTTATATCTCTTCGTACTACAAATAATT
-AATATCTCAACCCGTATTGTGTGATTCTAATTACCAACAGAATACGAGGAGGTTTTTGCT
-TAGGGCCATATATAATGAATCTATCTCGTTTATTCGCGGAACCCGAGATAACATTACGAT
-GTAACTATTTTAGAGAACTTAATACAAGAAACATTGCTGATTACTCATAACTAAATGCTT
-GGTAATATATCCTCAGTGCCCCTACCATCTTTTACGCAGGGATGTAATTACTTAGGATTC
-ATTGTGTAAGAATTACAATGAACGATGGATATGAAGGCATGTTGCGAGGTGTTCCTTGGT
-ATGTGAAGTTCGCAGGGCAACAAAAATTTCGCAGAATAGGCCTCAAAGTATTGGTAAAGA
-AGACAACTAATCATCACGAGCTTCTGATATCAATACGAACGAGTCCTGTGATGGATGAAA
-GAAAGTCGTATCGAAAATGTCAAGAGTCTGCCCAATGTAACTTACTTCAAAAAATAACGC
-TTCCGCCAAGTACGTTCGAATAAACGTAATTTTAAAAATACATAAGGGGTGTTAGAAAGT
-AAGCGACGGGATATAAGTTAGACTCAAGATTCCGCCGTAAAACGAGACTGATTCCGAAGA
-TTGTTCGTGGATCTGGTCATGACTTTCACTGAGTAAGGAGTTTCGACATATGTCAATAAA
-CACAAAAATAGAAGCTATTCGATCTGAAAAATATTAGGACAAGAAACTATCTCACGCTAG
-CCCAGAATATTCACTCACCCACGGGCGATACTAAAGCACTATATAGTCGCGTGATTACTA
-TACATATGGTACACATAAGAATCACGATCAGGTTCTCAATTTTCAACAATATATGTTTAT
-TTGCATAGGTAATATTAGGCCTTTAAGAGAAGGATGGGTGAGATACTCCGGGGATGGCGG
-CAATAAAGAAAAACACGATATGAGTAATAGGATCCTAATATCTTGGCGAGAGACTTAAGG
-TACGAATTTTGCGCAATCTATTTTTTACTTGGCCAGAATTCATGTATGGTATAAGTACGA
-ACTTTTTTGATCACTTTCATGGCTACCTGATTAGGATAGTTTGAGGAATTTCCCAAATAT
-ACCGATTTAATATACACTAGGGCTTGTCACTTTGAGTCAGAAAAAGAATATAATTACTTA
-GGGTAATGCTGCATACATATTCTTATATTGCAAAGGTTCTCTGGGTAATCTTGAGCCTTC
-ACGATACCTGGTGAAGTGTT
diff --git a/test/bench/shootout/spectral-norm-parallel.go b/test/bench/shootout/spectral-norm-parallel.go
deleted file mode 100644
index 2706f39..0000000
--- a/test/bench/shootout/spectral-norm-parallel.go
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * Based on spectral-norm.c by Sebastien Loisel
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "math"
- "runtime"
-)
-
-var n = flag.Int("n", 2000, "count")
-var nCPU = flag.Int("ncpu", 4, "number of cpus")
-
-func evalA(i, j int) float64 { return 1 / float64(((i+j)*(i+j+1)/2 + i + 1)) }
-
-type Vec []float64
-
-func (v Vec) Times(i, n int, u Vec, c chan int) {
- for ; i < n; i++ {
- v[i] = 0
- for j := 0; j < len(u); j++ {
- v[i] += evalA(i, j) * u[j]
- }
- }
- c <- 1
-}
-
-func (v Vec) TimesTransp(i, n int, u Vec, c chan int) {
- for ; i < n; i++ {
- v[i] = 0
- for j := 0; j < len(u); j++ {
- v[i] += evalA(j, i) * u[j]
- }
- }
- c <- 1
-}
-
-func wait(c chan int) {
- for i := 0; i < *nCPU; i++ {
- <-c
- }
-}
-
-func (v Vec) ATimesTransp(u Vec) {
- x := make(Vec, len(u))
- c := make(chan int, *nCPU)
- for i := 0; i < *nCPU; i++ {
- go x.Times(i*len(v) / *nCPU, (i+1)*len(v) / *nCPU, u, c)
- }
- wait(c)
- for i := 0; i < *nCPU; i++ {
- go v.TimesTransp(i*len(v) / *nCPU, (i+1)*len(v) / *nCPU, x, c)
- }
- wait(c)
-}
-
-func main() {
- flag.Parse()
- runtime.GOMAXPROCS(*nCPU)
- N := *n
- u := make(Vec, N)
- for i := 0; i < N; i++ {
- u[i] = 1
- }
- v := make(Vec, N)
- for i := 0; i < 10; i++ {
- v.ATimesTransp(u)
- u.ATimesTransp(v)
- }
- var vBv, vv float64
- for i := 0; i < N; i++ {
- vBv += u[i] * v[i]
- vv += v[i] * v[i]
- }
- fmt.Printf("%0.9f\n", math.Sqrt(vBv/vv))
-}
diff --git a/test/bench/shootout/spectral-norm.c b/test/bench/shootout/spectral-norm.c
deleted file mode 100644
index 832eb3d..0000000
--- a/test/bench/shootout/spectral-norm.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* -*- mode: c -*-
- *
- * The Great Computer Language Shootout
- * http://shootout.alioth.debian.org/
- *
- * Contributed by Sebastien Loisel
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-double eval_A(int i, int j) { return 1.0/((i+j)*(i+j+1)/2+i+1); }
-
-void eval_A_times_u(int N, const double u[], double Au[])
-{
- int i,j;
- for(i=0;i<N;i++)
- {
- Au[i]=0;
- for(j=0;j<N;j++) Au[i]+=eval_A(i,j)*u[j];
- }
-}
-
-void eval_At_times_u(int N, const double u[], double Au[])
-{
- int i,j;
- for(i=0;i<N;i++)
- {
- Au[i]=0;
- for(j=0;j<N;j++) Au[i]+=eval_A(j,i)*u[j];
- }
-}
-
-void eval_AtA_times_u(int N, const double u[], double AtAu[])
-{ double v[N]; eval_A_times_u(N,u,v); eval_At_times_u(N,v,AtAu); }
-
-int main(int argc, char *argv[])
-{
- int i;
- int N = ((argc == 2) ? atoi(argv[1]) : 2000);
- double u[N],v[N],vBv,vv;
- for(i=0;i<N;i++) u[i]=1;
- for(i=0;i<10;i++)
- {
- eval_AtA_times_u(N,u,v);
- eval_AtA_times_u(N,v,u);
- }
- vBv=vv=0;
- for(i=0;i<N;i++) { vBv+=u[i]*v[i]; vv+=v[i]*v[i]; }
- printf("%0.9f\n",sqrt(vBv/vv));
- return 0;
-}
diff --git a/test/bench/shootout/spectral-norm.go b/test/bench/shootout/spectral-norm.go
deleted file mode 100644
index 6667f3e..0000000
--- a/test/bench/shootout/spectral-norm.go
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- * Based on spectral-norm.c by Sebastien Loisel
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "math"
-)
-
-var n = flag.Int("n", 2000, "count")
-
-func evalA(i, j int) float64 { return 1 / float64(((i+j)*(i+j+1)/2 + i + 1)) }
-
-type Vec []float64
-
-func (v Vec) Times(u Vec) {
- for i := 0; i < len(v); i++ {
- v[i] = 0
- for j := 0; j < len(u); j++ {
- v[i] += evalA(i, j) * u[j]
- }
- }
-}
-
-func (v Vec) TimesTransp(u Vec) {
- for i := 0; i < len(v); i++ {
- v[i] = 0
- for j := 0; j < len(u); j++ {
- v[i] += evalA(j, i) * u[j]
- }
- }
-}
-
-func (v Vec) ATimesTransp(u Vec) {
- x := make(Vec, len(u))
- x.Times(u)
- v.TimesTransp(x)
-}
-
-func main() {
- flag.Parse()
- N := *n
- u := make(Vec, N)
- for i := 0; i < N; i++ {
- u[i] = 1
- }
- v := make(Vec, N)
- for i := 0; i < 10; i++ {
- v.ATimesTransp(u)
- u.ATimesTransp(v)
- }
- var vBv, vv float64
- for i := 0; i < N; i++ {
- vBv += u[i] * v[i]
- vv += v[i] * v[i]
- }
- fmt.Printf("%0.9f\n", math.Sqrt(vBv/vv))
-}
diff --git a/test/bench/shootout/spectral-norm.txt b/test/bench/shootout/spectral-norm.txt
deleted file mode 100644
index b988598..0000000
--- a/test/bench/shootout/spectral-norm.txt
+++ /dev/null
@@ -1 +0,0 @@
-1.274224152
diff --git a/test/bench/shootout/threadring.c b/test/bench/shootout/threadring.c
deleted file mode 100644
index 606db71..0000000
--- a/test/bench/shootout/threadring.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/*
-* The Computer Language Benchmarks Game
-* http://shootout.alioth.debian.org/
-
-* contributed by Premysl Hruby
-*/
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <pthread.h>
-#include <string.h>
-#include <limits.h>
-
-// PTHREAD_STACK_MIN undeclared on mingw
-#ifndef PTHREAD_STACK_MIN
-#define PTHREAD_STACK_MIN 65535
-#endif
-
-#define THREADS (503)
-
-struct stack {
- char x[PTHREAD_STACK_MIN];
-};
-
-
-/* staticaly initialize mutex[0] mutex */
-static pthread_mutex_t mutex[THREADS];
-static int data[THREADS];
-static struct stack stacks[THREADS];
-/* stacks must be defined staticaly, or my i386 box run of virtual memory for this
- * process while creating thread +- #400 */
-
-static void* thread(void *num)
-{
- int l = (int)(uintptr_t)num;
- int r = (l+1) % THREADS;
- int token;
-
- while(1) {
- pthread_mutex_lock(mutex + l);
- token = data[l];
- if (token) {
- data[r] = token - 1;
- pthread_mutex_unlock(mutex + r);
- }
- else {
- printf("%i\n", l+1);
- exit(0);
- }
- }
-}
-
-
-
-int main(int argc, char **argv)
-{
- int i;
- pthread_t cthread;
- pthread_attr_t stack_attr;
-
- if (argc != 2)
- exit(255);
- data[0] = atoi(argv[1]);
-
- pthread_attr_init(&stack_attr);
-
- for (i = 0; i < THREADS; i++) {
- pthread_mutex_init(mutex + i, NULL);
- pthread_mutex_lock(mutex + i);
-
-#if defined(__MINGW32__) || defined(__MINGW64__)
- pthread_attr_setstackaddr(&stack_attr, &stacks[i]);
- pthread_attr_setstacksize(&stack_attr, sizeof(struct stack));
-#else
- pthread_attr_setstack(&stack_attr, &stacks[i], sizeof(struct stack));
-#endif
-
- pthread_create(&cthread, &stack_attr, thread, (void*)(uintptr_t)i);
- }
-
- pthread_mutex_unlock(mutex + 0);
- pthread_join(cthread, NULL);
-}
diff --git a/test/bench/shootout/threadring.go b/test/bench/shootout/threadring.go
deleted file mode 100644
index e76dd0b..0000000
--- a/test/bench/shootout/threadring.go
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- * Neither the name of "The Computer Language Benchmarks Game" nor the
- name of "The Computer Language Shootout Benchmarks" nor the names of
- its contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-*/
-
-/* The Computer Language Benchmarks Game
- * http://shootout.alioth.debian.org/
- *
- * contributed by The Go Authors.
- */
-
-package main
-
-import (
- "flag"
- "fmt"
- "os"
-)
-
-var n = flag.Int("n", 1000, "how many passes")
-
-const Nthread = 503
-
-func f(i int, in <-chan int, out chan<- int) {
- for {
- n := <-in
- if n == 0 {
- fmt.Printf("%d\n", i)
- os.Exit(0)
- }
- out <- n - 1
- }
-}
-
-func main() {
- flag.Parse()
-
- one := make(chan int) // will be input to thread 1
- var in, out chan int = nil, one
- for i := 1; i <= Nthread-1; i++ {
- in, out = out, make(chan int)
- go f(i, in, out)
- }
- go f(Nthread, out, one)
- one <- *n
- <-make(chan int) // hang until ring completes
-}
diff --git a/test/bench/shootout/threadring.txt b/test/bench/shootout/threadring.txt
deleted file mode 100644
index f9aaa4d..0000000
--- a/test/bench/shootout/threadring.txt
+++ /dev/null
@@ -1 +0,0 @@
-498
diff --git a/test/bench/shootout/timing.log b/test/bench/shootout/timing.log
deleted file mode 100644
index 4e7d17a..0000000
--- a/test/bench/shootout/timing.log
+++ /dev/null
@@ -1,1254 +0,0 @@
-All tests on r45 or r70
-
-Aug 3 2009
-
-First version of fasta. Translation of fasta.c, fetched from
- http://shootout.alioth.debian.org/u32q/benchmark.php?test=fasta&lang=gpp&id=4
-
-fasta -n 25000000
- gcc -O2 fasta.c 5.98u 0.00s 6.01r
- gccgo -O2 fasta.go 8.82u 0.02s 8.85r
- 6g fasta.go 13.50u 0.02s 13.53r
- 6g -B fata.go 12.99u 0.02s 13.02r
-
-Aug 4 2009
-[added timing.sh]
-
-# myrandom:
-# hand-written optimization of integer division
-# use int32->float conversion
-fasta -n 25000000
- # probably I/O library inefficiencies
- gcc -O2 fasta.c 5.99u 0.00s 6.00r
- gccgo -O2 fasta.go 8.82u 0.02s 8.85r
- gc fasta 10.70u 0.00s 10.77r
- gc_B fasta 10.09u 0.03s 10.12r
-
-reverse-complement < output-of-fasta-25000000
- # we don't know - memory cache behavior?
- gcc -O2 reverse-complement.c 2.04u 0.94s 10.54r
- gccgo -O2 reverse-complement.go 6.54u 0.63s 7.17r
- gc reverse-complement 6.55u 0.70s 7.26r
- gc_B reverse-complement 6.32u 0.70s 7.10r
-
-nbody 50000000
- # math.Sqrt needs to be in assembly; inlining is probably the other 50%
- gcc -O2 nbody.c 21.61u 0.01s 24.80r
- gccgo -O2 nbody.go 118.55u 0.02s 120.32r
- gc nbody 100.84u 0.00s 100.85r
- gc_B nbody 103.33u 0.00s 103.39r
-[
-hacked Sqrt in assembler
- gc nbody 31.97u 0.00s 32.01r
-]
-
-binary-tree 15 # too slow to use 20
- # memory allocation and garbage collection
- gcc -O2 binary-tree.c -lm 0.86u 0.00s 0.87r
- gccgo -O2 binary-tree.go 1.69u 0.46s 2.15r
- gccgo -O2 binary-tree-freelist.go 8.48u 0.00s 8.48r
- gc binary-tree 9.60u 0.01s 9.62r
- gc binary-tree-freelist 0.48u 0.01s 0.50r
-
-August 5, 2009
-
-fannkuch 12
- # bounds checking is half the difference
- # rest might be registerization
- gcc -O2 fannkuch.c 60.09u 0.01s 60.32r
- gccgo -O2 fannkuch.go 64.89u 0.00s 64.92r
- gc fannkuch 124.59u 0.00s 124.67r
- gc_B fannkuch 91.14u 0.00s 91.16r
-
-regex-dna 100000
- # regexp code is slow on trivial regexp
- gcc -O2 regex-dna.c -lpcre 0.92u 0.00s 0.99r
- gc regexp-dna 26.94u 0.18s 28.75r
- gc_B regexp-dna 26.51u 0.09s 26.75r
-
-spectral-norm 5500
- gcc -O2 spectral-norm.c -lm 11.54u 0.00s 11.55r
- gccgo -O2 spectral-norm.go 12.20u 0.00s 12.23r
- gc spectral-norm 50.23u 0.00s 50.36r
- gc_B spectral-norm 49.69u 0.01s 49.83r
- gc spectral-norm-parallel 24.47u 0.03s 11.05r # has shift >>1 not div /2
- [using >>1 instead of /2 : gc gives 24.33u 0.00s 24.33r]
-
-August 6, 2009
-
-k-nucleotide 5000000
- # string maps are slower than glib string maps
- gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0 k-nucleotide.c: 10.72u 0.01s 10.74r
- gccgo -O2 k-nucleotide.go 21.64u 0.83s 22.78r
- gc k-nucleotide 16.08u 0.06s 16.50r
- gc_B k-nucleotide 17.32u 0.02s 17.37r
-
-mandelbrot 5500
- # floating point code generator should use more registers
- gcc -O2 mandelbrot.c 56.13u 0.02s 56.17r
- gccgo -O2 mandelbrot.go 57.49u 0.01s 57.51r
- gc mandelbrot 74.32u 0.00s 74.35r
- gc_B mandelbrot 74.28u 0.01s 74.31r
-
-meteor 2100
- # we don't know
- gcc -O2 meteor-contest.c 0.10u 0.00s 0.10r
- gccgo -O2 meteor-contest.go 0.12u 0.00s 0.14r
- gc meteor-contest 0.24u 0.00s 0.26r
- gc_B meteor-contest 0.23u 0.00s 0.24r
-
-pidigits 10000
- # bignum is slower than gmp
- gcc -O2 pidigits.c -lgmp 2.60u 0.00s 2.62r
- gc pidigits 77.69u 0.14s 78.18r
- gc_B pidigits 74.26u 0.18s 75.41r
- gc_B pidigits 68.48u 0.20s 69.31r # special case: no bounds checking in bignum
-
-August 7 2009
-
-# New gc does better division by powers of 2. Significant improvements:
-
-spectral-norm 5500
- # floating point code generator should use more registers; possibly inline evalA
- gcc -O2 spectral-norm.c -lm 11.50u 0.00s 11.50r
- gccgo -O2 spectral-norm.go 12.02u 0.00s 12.02r
- gc spectral-norm 23.98u 0.00s 24.00r # new time is 0.48 times old time, 52% faster
- gc_B spectral-norm 23.71u 0.01s 23.72r # ditto
- gc spectral-norm-parallel 24.04u 0.00s 6.26r # /2 put back. note: 4x faster (on r70, idle)
-
-k-nucleotide 1000000
- # string maps are slower than glib string maps
- gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0 10.82u 0.04s 10.87r
- gccgo -O2 k-nucleotide.go 22.73u 0.89s 23.63r
- gc k-nucleotide 15.97u 0.03s 16.04r
- gc_B k-nucleotide 15.86u 0.06s 15.93r # 8.5% faster, but probably due to weird cache effeccts in previous version
-
-pidigits 10000
- # bignum is slower than gmp
- gcc -O2 pidigits.c -lgmp 2.58u 0.00s 2.58r
- gc pidigits 71.24u 0.04s 71.28r # 8.5% faster
- gc_B pidigits 71.25u 0.03s 71.29r # 4% faster
-
-threadring 50000000
- gcc -O2 threadring.c -lpthread 35.51u 160.21s 199.50r
- gccgo -O2 threadring.go 90.33u 459.95s 448.03r
- gc threadring 33.11u 0.00s 33.14r
- GOMAXPROCS=4 gc threadring 114.48u 226.65s 371.59r
- # change wait code to do <-make(chan int) instead of time.Sleep
- gc threadring 28.41u 0.01s 29.35r
- GOMAXPROCS=4 gc threadring 112.59u 232.83s 384.72r
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 18.14u 276.52s 76.93r
- gc chameneosredux 20.19u 0.01s 20.23r
-
-Aug 10 2009
-
-# new 6g with better fp registers, fast div and mod of integers
-# complete set of timings listed. significant changes marked ***
-
-fasta -n 25000000
- # probably I/O library inefficiencies
- gcc -O2 fasta.c 5.96u 0.00s 5.97r
- gc fasta 10.59u 0.01s 10.61r
- gc_B fasta 9.92u 0.02s 9.95r
-
-reverse-complement < output-of-fasta-25000000
- # we don't know - memory cache behavior?
- gcc -O2 reverse-complement.c 1.96u 1.56s 16.23r
- gccgo -O2 reverse-complement.go 6.41u 0.62s 7.05r
- gc reverse-complement 6.46u 0.70s 7.17r
- gc_B reverse-complement 6.22u 0.72s 6.95r
-
-nbody 50000000
- # math.Sqrt needs to be in assembly; inlining is probably the other 50%
- gcc -O2 nbody.c 21.26u 0.01s 21.28r
- gccgo -O2 nbody.go 116.68u 0.07s 116.80r
- gc nbody 86.64u 0.01s 86.68r # -14%
- gc_B nbody 85.72u 0.02s 85.77r # *** -17%
-
-binary-tree 15 # too slow to use 20
- # memory allocation and garbage collection
- gcc -O2 binary-tree.c -lm 0.87u 0.00s 0.87r
- gccgo -O2 binary-tree.go 1.61u 0.47s 2.09r
- gccgo -O2 binary-tree-freelist.go 0.00u 0.00s 0.01r
- gc binary-tree 9.11u 0.01s 9.13r # *** -5%
- gc binary-tree-freelist 0.47u 0.01s 0.48r
-
-fannkuch 12
- # bounds checking is half the difference
- # rest might be registerization
- gcc -O2 fannkuch.c 59.92u 0.00s 59.94r
- gccgo -O2 fannkuch.go 65.54u 0.00s 65.58r
- gc fannkuch 123.98u 0.01s 124.04r
- gc_B fannkuch 90.75u 0.00s 90.78r
-
-regex-dna 100000
- # regexp code is slow on trivial regexp
- gcc -O2 regex-dna.c -lpcre 0.91u 0.00s 0.92r
- gc regex-dna 27.25u 0.02s 27.28r
- gc_B regex-dna 29.51u 0.03s 29.55r
-
-spectral-norm 5500
- # possibly inline evalA
- gcc -O2 spectral-norm.c -lm 11.57u 0.00s 11.57r
- gccgo -O2 spectral-norm.go 12.07u 0.01s 12.08r
- gc spectral-norm 23.99u 0.00s 24.00r
- gc_B spectral-norm 23.73u 0.00s 23.75r
-
-k-nucleotide 1000000
- # string maps are slower than glib string maps
- gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0 10.63u 0.02s 10.69r
- gccgo -O2 k-nucleotide.go 23.19u 0.91s 24.12r
- gc k-nucleotide 16.73u 0.04s 16.78r # *** +5% (but this one seems to vary by more than that)
- gc_B k-nucleotide 16.46u 0.04s 16.51r # *** +5%
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 56.16u 0.00s 56.16r
- gccgo -O2 mandelbrot.go 57.41u 0.01s 57.42r
- gc mandelbrot 64.05u 0.02s 64.08r # *** -14%
- gc_B mandelbrot 64.10u 0.02s 64.14r # *** -14%
-
-meteor 2100
- # we don't know
- gcc -O2 meteor-contest.c 0.10u 0.00s 0.10r
- gccgo -O2 meteor-contest.go 0.12u 0.00s 0.12r
- gc meteor-contest 0.18u 0.00s 0.20r # *** -25%
- gc_B meteor-contest 0.17u 0.00s 0.18r # *** -24%
-
-pidigits 10000
- # bignum is slower than gmp
- gcc -O2 pidigits.c -lgmp 2.57u 0.00s 2.57r
- gc pidigits 71.82u 0.04s 71.89r
- gc_B pidigits 71.84u 0.08s 71.98r
-
-threadring 50000000
- gcc -O2 threadring.c -lpthread 30.91u 164.33s 204.57r
- gccgo -O2 threadring.go 87.12u 460.04s 447.61r
- gc threadring 38.55u 0.00s 38.56r # *** +16%
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 17.93u 323.65s 88.47r
- gc chameneosredux 21.72u 0.00s 21.73r
-
-August 10 2009
-
-# In-place versions for some bignum operations.
-pidigits 10000
- gcc -O2 pidigits.c -lgmp 2.56u 0.00s 2.57r
- gc pidigits 55.22u 0.04s 55.29r # *** -23%
- gc_B pidigits 55.49u 0.02s 55.60r # *** -23%
-
-September 3 2009
-
-# New 6g inlines slices, has a few other tweaks.
-# Complete rerun. Significant changes marked.
-
-fasta -n 25000000
- # probably I/O library inefficiencies
- gcc -O2 fasta.c 5.96u 0.00s 5.96r
- gc fasta 10.63u 0.02s 10.66r
- gc_B fasta 9.92u 0.01s 9.94r
-
-reverse-complement < output-of-fasta-25000000
- # we don't know - memory cache behavior?
- gcc -O2 reverse-complement.c 1.92u 0.33s 2.93r
- gccgo -O2 reverse-complement.go 6.76u 0.72s 7.58r # +5%
- gc reverse-complement 6.59u 0.70s 7.29r # +2%
- gc_B reverse-complement 5.57u 0.80s 6.37r # -10%
-
-nbody 50000000
- # math.Sqrt needs to be in assembly; inlining is probably the other 50%
- # also loop alignment appears to be critical
- gcc -O2 nbody.c 21.28u 0.00s 21.28r
- gccgo -O2 nbody.go 119.21u 0.00s 119.22r # +2%
- gc nbody 109.72u 0.00s 109.78r # + 28% *****
- gc_B nbody 85.90u 0.00s 85.91r
-
-binary-tree 15 # too slow to use 20
- # memory allocation and garbage collection
- gcc -O2 binary-tree.c -lm 0.86u 0.00s 0.87r
- gccgo -O2 binary-tree.go 1.88u 0.54s 2.42r # +17%
- gccgo -O2 binary-tree-freelist.go 0.01u 0.01s 0.02r
- gc binary-tree 8.94u 0.01s 8.96r # -2%
- gc binary-tree-freelist 0.47u 0.01s 0.48r
-
-fannkuch 12
- # bounds checking is half the difference
- # rest might be registerization
- gcc -O2 fannkuch.c 60.12u 0.00s 60.12r
- gccgo -O2 fannkuch.go 92.62u 0.00s 92.66r # +41% ***
- gc fannkuch 123.90u 0.00s 123.92r
- gc_B fannkuch 89.71u 0.00s 89.74r # -1%
-
-regex-dna 100000
- # regexp code is slow on trivial regexp
- gcc -O2 regex-dna.c -lpcre 0.88u 0.00s 0.88r
- gc regex-dna 25.77u 0.01s 25.79r # -5%
- gc_B regex-dna 26.05u 0.02s 26.09r # -12% ***
-
-spectral-norm 5500
- # possibly inline evalA
- gcc -O2 spectral-norm.c -lm 11.51u 0.00s 11.51r
- gccgo -O2 spectral-norm.go 11.95u 0.00s 11.96r
- gc spectral-norm 24.23u 0.00s 24.23r
- gc_B spectral-norm 23.83u 0.00s 23.84r
-
-k-nucleotide 1000000
- # string maps are slower than glib string maps
- gcc -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include k-nucleotide.c -lglib-2.0 10.68u 0.04s 10.72r
- gccgo -O2 k-nucleotide.go 23.03u 0.88s 23.92r
- gc k-nucleotide 15.79u 0.05s 15.85r # -5% (but this one seems to vary by more than that)
- gc_B k-nucleotide 17.88u 0.05s 17.95r # +8% (ditto)
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 56.17u 0.02s 56.20r
- gccgo -O2 mandelbrot.go 56.74u 0.02s 56.79r # -1%
- gc mandelbrot 63.31u 0.01s 63.35r # -1%
- gc_B mandelbrot 63.29u 0.00s 63.31r # -1%
-
-meteor 2100
- # we don't know
- gcc -O2 meteor-contest.c 0.10u 0.00s 0.10r
- gccgo -O2 meteor-contest.go 0.11u 0.00s 0.12r
- gc meteor-contest 0.18u 0.00s 0.19r
- gc_B meteor-contest 0.17u 0.00s 0.18r
-
-pidigits 10000
- # bignum is slower than gmp
- gcc -O2 pidigits.c -lgmp 2.56u 0.00s 2.57r
- gc pidigits 55.87u 0.03s 55.91r
- gc_B pidigits 55.93u 0.03s 55.99r
-
-# these tests are compared using real time, since they run multiple processors
-# accuracy probably low
-threadring 50000000
- gcc -O2 threadring.c -lpthread 26.31u 164.69s 199.92r # -2%
- gccgo -O2 threadring.go 87.90u 487.26s 472.81r # +6%
- gc threadring 28.89u 0.00s 28.90r # -25% ***
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 16.41u 296.91s 81.17r # -8%
- gc chameneosredux 19.97u 0.00s 19.97r # -8%
-
-Sep 22, 2009
-
-# 6g inlines sliceslice in most cases.
-
-fasta -n 25000000
- # probably I/O library inefficiencies
- gc fasta 10.24u 0.00s 10.25r # -4%
- gc_B fasta 9.68u 0.01s 9.69r # -3%
-
-reverse-complement < output-of-fasta-25000000
- # we don't know - memory cache behavior?
- gc reverse-complement 6.67u 0.69s 7.37r # +1%
- gc_B reverse-complement 6.00u 0.64s 6.65r # +7%
-
-nbody -n 50000000
- # math.Sqrt needs to be in assembly; inlining is probably the other 50%
- # also loop alignment appears to be critical
- gc nbody 86.27u 0.00s 86.29r # -21%
- gc_B nbody 104.52u 0.00s 104.54r # +22%
-
-fannkuch 12
- # bounds checking is half the difference
- # rest might be registerization
- gc fannkuch 128.36u 0.00s 128.37r # +4%
- gc_B fannkuch 89.32u 0.00s 89.34r
-
-regex-dna 100000
- # regexp code is slow on trivial regexp
- gc regex-dna 24.82u 0.01s 24.86r # -4%
- gc_B regex-dna 24.55u 0.01s 24.57r # -6%
-
-spectral-norm 5500
- # possibly inline evalA
- gc spectral-norm 24.05u 0.00s 24.07r # -1%
- gc_B spectral-norm 23.60u 0.00s 23.65r # -1%
-
-k-nucleotide 1000000
- # string maps are slower than glib string maps
- gc k-nucleotide 17.84u 0.04s 17.89r # +13% but mysterious variation continues
- gc_B k-nucleotide 15.56u 0.08s 15.65r # -13% (ditto)
-
-mandelbrot 16000
- gc mandelbrot 64.08u 0.01s 64.11r # +1%
- gc_B mandelbrot 64.04u 0.00s 64.05r # +1%
-
-pidigits 10000
- # bignum is slower than gmp
- gc pidigits 58.68u 0.02s 58.72r # +5%
- gc_B pidigits 58.86u 0.05s 58.99r # +5%
-
-# these tests are compared using real time, since they run multiple processors
-# accuracy probably low
-threadring 50000000
- gc threadring 32.70u 0.02s 32.77r # +13%
-
-chameneos 6000000
- gc chameneosredux 26.62u 0.00s 26.63r # +13%
-
-Sep 24, 2009
-
-# Sqrt now in assembler for 6g.
-nbody -n 50000000
- # remember, at least for 6g, alignment of loops may be important
- gcc -O2 nbody.c 21.24u 0.00s 21.25r
- gccgo -O2 nbody.go 121.03u 0.00s 121.04r
- gc nbody 30.26u 0.00s 30.27r # -65% ***
- gc_B nbody 30.20u 0.02s 30.22r # -72% ***
-
-Nov 13 2009
-
-# fix bug in regexp; take performance hit. good regexps will come in time.
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.92u 0.00s 0.94r
- gc regex-dna 29.78u 0.03s 29.83r
- gc_B regex-dna 32.63u 0.03s 32.74r
-
-Nov 24 2009
-
-# Roger Peppe's rewrite of the benchmark
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 18.00u 303.29s 83.64r
- gc chameneosredux 12.10u 0.00s 12.10r # 2.22X faster
-
-Jan 6, 2010
-
-# Long-overdue update. All numbers included in this complete run.
-# Some programs (e.g. reverse-complement) rewritten for speed.
-# Regular expressions much faster in common cases (although still far behind PCRE)
-# Bignum stuff improved
-# Better (but sometimes slower) locking in channels.
-
-fasta -n 25000000
- gcc -O2 fasta.c 5.99u 0.01s 6.00r
- gc fasta 9.11u 0.00s 9.12r # -11%
- gc_B fasta 8.60u 0.00s 8.62r # +12% ??
-
-reverse-complement < output-of-fasta-25000000
- gcc -O2 reverse-complement.c 2.00u 0.80s 9.54r
-# gccgo -O2 reverse-complement.go 4.57u 0.35s 4.94r # 33% faster
- gc reverse-complement 2.01u 0.38s 2.40r # 3.3X faster
- gc_B reverse-complement 1.88u 0.36s 2.24r # 3.2X faster
-GOGC=off
- gc reverse-complement 2.01u 0.35s 2.37r
- gc_B reverse-complement 1.86u 0.32s 2.19r
-
-nbody -n 50000000
- gcc -O2 nbody.c 21.28u 0.00s 21.31r
- gccgo -O2 nbody.go 80.02u 0.00s 80.05r # 33% faster
- gc nbody 30.13u 0.00s 30.13r
- gc_B nbody 29.89u 0.01s 29.91r
-
-binary-tree 15 # too slow to use 20
- gcc -O2 binary-tree.c -lm 0.86u 0.00s 0.87r
- gccgo -O2 binary-tree.go 4.82u 0.41s 5.24r # 2.5X slower
- gc binary-tree 7.23u 0.01s 7.25r # # -19%
- gc binary-tree-freelist 0.43u 0.00s 0.44r # -9%
-
-fannkuch 12
- gcc -O2 fannkuch.c 60.17u 0.00s 60.17r
- gccgo -O2 fannkuch.go 78.47u 0.01s 78.49r
- gc fannkuch 128.86u 0.00s 128.96r
- gc_B fannkuch 90.17u 0.00s 90.21r
-
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.90u 0.00s 0.92r
- gc regex-dna 9.48u 0.01s 9.50r # 3.1X faster
- gc_B regex-dna 9.08u 0.00s 9.10r # 3.6X faster
-
-spectral-norm 5500
- gcc -O2 spectral-norm.c -lm 11.48u 0.00s 11.48r
- gccgo -O2 spectral-norm.go 11.68u 0.00s 11.70r
- gc spectral-norm 23.98u 0.00s 23.99r
- gc_B spectral-norm 23.68u 0.00s 23.69r
-
-k-nucleotide 1000000
- gcc -O2 k-nucleotide.c 10.85u 0.04s 10.90r
- gccgo -O2 k-nucleotide.go 25.26u 0.87s 26.14r
- gc k-nucleotide 15.28u 0.06s 15.37r # restored; mysterious variation continues
- gc_B k-nucleotide 15.97u 0.03s 16.00r
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 56.12u 0.01s 56.15r
- gccgo -O2 mandelbrot.go 56.86u 0.01s 56.89r
- gc mandelbrot 66.05u 0.00s 66.07r # -3%
- gc_B mandelbrot 66.06u 0.00s 66.07r # -3%
-
-meteor 2100
- gcc -O2 meteor-contest.c 0.10u 0.00s 0.10r
- gccgo -O2 meteor-contest.go 0.12u 0.00s 0.12r
- gc meteor-contest 0.17u 0.00s 0.17r
- gc_B meteor-contest 0.15u 0.00s 0.16r
-
-pidigits 10000
- gcc -O2 pidigits.c -lgmp 2.57u 0.00s 2.59r
- gc pidigits 38.27u 0.02s 38.30r # 1.5X faster
- gc_B pidigits 38.27u 0.02s 38.31r # 1.5X faster
-
-threadring 50000000
- gcc -O2 threadring.c 37.11u 170.59s 212.75r
- gccgo -O2 threadring.go 89.67u 447.56s 442.55r # -6.5%
- gc threadring 36.08u 0.04s 36.15r # +10%
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 19.02u 331.08s 90.79r
- gc chameneosredux 12.54u 0.00s 12.55r
-
-Oct 19, 2010
-
-# Another long-overdue update. Some of the code is new; parallel versions
-# of some are added. A few significant improvements.
-
-fasta -n 25000000
- gcc -O2 fasta.c 4.92u 0.00s 4.93r
- gccgo -O2 fasta.go 3.31u 0.00s 3.34r # new code
- gc fasta 3.68u 0.00s 3.69r # 2.5X faster with no code
- gc_B fasta 3.68u 0.00s 3.69r # 2.3X faster with no code
-
-reverse-complement < output-of-fasta-25000000
- gcc -O2 reverse-complement.c 1.93u 0.81s 11.24r
- gccgo -O2 reverse-complement.go 1.58u 0.43s 2.04r # first run with new code?
- gc reverse-complement 1.84u 0.34s 2.20r # 10% faster
- gc_B reverse-complement 1.85u 0.32s 2.18r
-
-nbody -n 50000000
- gcc -O2 nbody.c 21.35u 0.00s 21.36r
- gccgo -O2 nbody.go 21.62u 0.00s 21.66r # 3.7X faster - why??
- gc nbody 29.78u 0.00s 29.79r
- gc_B nbody 29.72u 0.00s 29.72r
-
-binary-tree 15 # too slow to use 20
- gcc -O2 binary-tree.c -lm 0.86u 0.00s 0.88r
- gccgo -O2 binary-tree.go 4.05u 0.02s 4.08r # 28% faster
- gccgo -O2 binary-tree-freelist 0.34u 0.08s 0.34r
- gc binary-tree 5.94u 0.00s 5.95r # 20% faster
- gc binary-tree-freelist 0.50u 0.01s 0.54r
-
-fannkuch 12
- gcc -O2 fannkuch.c 60.45u 0.00s 60.45r
- gccgo -O2 fannkuch.go 64.64u 0.00s 64.64r
- gccgo -O2 fannkuch-parallel.go 115.63u 0.00s 31.58r
- gc fannkuch 126.52u 0.04s 126.68r
- gc fannkuch-parallel 238.82u 0.10s 65.93r # GOMAXPROCS=4
- gc_B fannkuch 88.99u 0.00s 89.02r
-
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.89u 0.00s 0.89r
- gc regex-dna 8.99u 0.02s 9.03r
- gc regex-dna-parallel 8.94u 0.02s 3.68r # GOMAXPROCS=4
- gc_B regex-dna 9.12u 0.00s 9.14r
-
-spectral-norm 5500
- gcc -O2 spectral-norm.c -lm 11.55u 0.00s 11.57r
- gccgo -O2 spectral-norm.go 11.73u 0.00s 11.75r
- gc spectral-norm 23.74u 0.00s 23.79r
- gc_B spectral-norm 24.49u 0.02s 24.54r
-
-k-nucleotide 1000000
- gcc -O2 k-nucleotide.c 11.44u 0.06s 11.50r
- gccgo -O2 k-nucleotide.go 8.65u 0.04s 8.71r
- gccgo -O2 k-nucleotide-parallel.go 8.75u 0.03s 2.97r # set GOMAXPROCS=4
- gc k-nucleotide 14.92u 0.05s 15.01r
- gc k-nucleotide-parallel 16.96u 0.06s 6.53r # set GOMAXPROCS=4
- gc_B k-nucleotide 15.97u 0.03s 16.08r
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 56.32u 0.00s 56.35r
- gccgo -O2 mandelbrot.go 55.62u 0.02s 55.77r
- gc mandelbrot 64.85u 0.01s 64.94r
- gc_B mandelbrot 65.02u 0.01s 65.14r
-
-meteor 2100
- gcc -O2 meteor-contest.c 0.10u 0.00s 0.10r
- gccgo -O2 meteor-contest.go 0.10u 0.00s 0.11r
- gc meteor-contest 0.17u 0.00s 0.18r
- gc_B meteor-contest 0.16u 0.00s 0.16r
-
-pidigits 10000
- gcc -O2 pidigits.c -lgmp 2.58u 0.00s 2.59r
- gccgo -O2 pidigits.go 14.06u 0.01s 14.09r # first run?
- gc pidigits 8.47u 0.05s 8.55r # 4.5X faster due to package big
- gc_B pidigits 8.33u 0.01s 8.36r # 4.5X faster due to package big
-
-threadring 50000000
- gcc -O2 threadring.c 28.18u 153.19s 186.47r
- gccgo -O2 threadring.go 110.10u 516.48s 515.25r
- gc threadring 40.39u 0.00s 40.40r
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 18.20u 301.55s 83.10r
- gccgo -O2 chameneosredux.go 52.22u 324.54s 201.21r
- gc chameneosredux 13.52u 0.00s 13.54r
-
-Dec 14, 2010
-
-# Improved regex code (same algorithm) gets ~30%.
-
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.77u 0.01s 0.78r
- gc regex-dna 6.80u 0.00s 6.81r
- gc regex-dna-parallel 6.82u 0.01s 2.75r
- gc_B regex-dna 6.69u 0.02s 6.70r
-
-Feb 15, 2011
-
-# Improved GC, still single-threaded but more efficient
-
-fasta -n 25000000
- gcc -O2 fasta.c 3.40u 0.00s 3.40r
- gccgo -O2 fasta.go 3.51u 0.00s 3.50r
- gc fasta 3.66u 0.01s 3.66r
- gc_B fasta 3.66u 0.00s 3.66r
-
-reverse-complement < output-of-fasta-25000000
- gcc -O2 reverse-complement.c 1.86u 1.29s 4.93r
- gccgo -O2 reverse-complement.go 2.18u 0.41s 2.60r
- gc reverse-complement 1.67u 0.48s 2.15r
- gc_B reverse-complement 1.71u 0.45s 2.15r
-
-nbody -n 50000000
- gcc -O2 -lm nbody.c 21.64u 0.00s 21.64r
- gccgo -O2 nbody.go 21.46u 0.00s 21.45r
- gc nbody 29.07u 0.00s 29.06r
- gc_B nbody 31.61u 0.00s 31.61r
-
-binary-tree 15 # too slow to use 20
- gcc -O2 binary-tree.c -lm 0.88u 0.00s 0.87r
- gccgo -O2 binary-tree.go 2.74u 0.07s 2.81r
- gccgo -O2 binary-tree-freelist.go 0.01u 0.00s 0.00r
- gc binary-tree 4.22u 0.02s 4.24r
- gc binary-tree-freelist 0.54u 0.02s 0.55r
-
-fannkuch 12
- gcc -O2 fannkuch.c 57.64u 0.00s 57.64r
- gccgo -O2 fannkuch.go 65.79u 0.00s 65.82r
- gccgo -O2 fannkuch-parallel.go 160.91u 0.02s 43.90r
- gc fannkuch 126.36u 0.03s 126.53r
- gc fannkuch-parallel 175.23u 0.04s 45.49r
- gc_B fannkuch 89.23u 0.00s 89.24r
-
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.77u 0.01s 0.80r
- gccgo -O2 regex-dna.go 12.38u 0.10s 12.52r
- gccgo -O2 regex-dna-parallel.go 43.96u 4.64s 15.11r
- gc regex-dna 7.03u 0.01s 7.05r
- gc regex-dna-parallel 6.85u 0.05s 2.70r
- gc_B regex-dna 6.87u 0.02s 6.89r
-
-spectral-norm 5500
- gcc -O2 spectral-norm.c -lm 12.29u 0.00s 12.28r
- gccgo -O2 spectral-norm.go 11.79u 0.00s 11.79r
- gc spectral-norm 24.00u 0.02s 24.05r
- gc_B spectral-norm 24.59u 0.01s 24.59r
-
-k-nucleotide 1000000
- gcc -O2 k-nucleotide.c 9.75u 0.07s 9.82r
- gccgo -O2 k-nucleotide.go 8.92u 0.06s 8.98r
- gccgo -O2 k-nucleotide-parallel.go 8.40u 0.04s 2.76r
- gc k-nucleotide 17.01u 0.03s 17.04r
- gc k-nucleotide-parallel 16.51u 0.08s 6.21r
- gc_B k-nucleotide 16.94u 0.08s 17.02r
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 54.60u 0.00s 54.66r
- gccgo -O2 mandelbrot.go 59.38u 0.00s 59.41r
- gc mandelbrot 64.93u 0.04s 65.08r
- gc_B mandelbrot 64.85u 0.03s 64.92r
-
-meteor 2098
- gcc -O2 meteor-contest.c 0.10u 0.01s 0.10r
- gccgo -O2 meteor-contest.go 0.11u 0.00s 0.11r
- gc meteor-contest 0.18u 0.00s 0.17r
- gc_B meteor-contest 0.17u 0.00s 0.16r
-
-pidigits 10000
- gcc -O2 pidigits.c -lgmp 2.24u 0.00s 2.23r
- gccgo -O2 pidigits.go 14.05u 0.00s 14.06r
- gc pidigits 6.34u 0.05s 6.38r
- gc_B pidigits 6.37u 0.02s 6.38r
-
-threadring 50000000
- gcc -O2 threadring.c 30.50u 258.05s 325.72r
- gccgo -O2 threadring.go 92.87u 748.39s 728.46r
- gc threadring 38.03u 0.01s 38.04r
-
-# Apr 15, 2011
-# Move to new machine, Intel Xeon [email protected].
-# (Was Opteron(tm) Processor 8214 HE)
-
-fasta -n 25000000
-OLD:
- gcc -O2 fasta.c 3.39u 0.04s 3.42r
- gccgo -O2 fasta.go 3.52u 0.00s 3.52r
- gc fasta 3.63u 0.04s 3.67r
- gc_B fasta 3.66u 0.00s 3.66r
-NEW:
- gcc -O2 fasta.c 1.45u 0.02s 1.47r
- gccgo -O2 fasta.go 1.51u 0.01s 1.51r
- gc fasta 2.04u 0.00s 2.04r
- gc_B fasta 2.05u 0.00s 2.04r
-
-reverse-complement < output-of-fasta-25000000
-OLD:
- gcc -O2 reverse-complement.c 1.87u 1.51s 7.02r
- gccgo -O2 reverse-complement.go 1.56u 0.54s 3.37r
- gc reverse-complement 1.73u 0.36s 2.08r
- gc_B reverse-complement 1.75u 0.37s 2.12r
-NEW:
- gcc -O2 reverse-complement.c 1.20u 0.47s 12.96r
- gccgo -O2 reverse-complement.go 0.88u 0.14s 1.01r
- gc reverse-complement 1.13u 0.17s 1.30r
- gc_B reverse-complement 1.11u 0.09s 1.20r
-
-nbody -n 50000000
-OLD:
- gcc -O2 -lm nbody.c 21.90u 0.00s 21.92r
- gccgo -O2 nbody.go 23.12u 0.03s 23.19r
- gc nbody 29.07u 0.00s 29.07r
- gc_B nbody 31.84u 0.00s 31.85r
-NEW:
- gcc -O2 -lm nbody.c 13.01u 0.00s 13.03r
- gccgo -O2 nbody.go 13.35u 0.00s 13.37r
- gc nbody 21.78u 0.00s 21.82r
- gc_B nbody 21.72u 0.00s 21.76r
-
-binary-tree 15 # too slow to use 20
-OLD:
- gcc -O2 binary-tree.c -lm 0.83u 0.02s 0.84r
- gccgo -O2 binary-tree.go 2.61u 0.02s 2.62r
- gccgo -O2 binary-tree-freelist.go 0.32u 0.01s 0.32r
- gc binary-tree 3.93u 0.04s 3.97r
- gc binary-tree-freelist 0.47u 0.03s 0.50r
-NEW:
- gcc -O2 binary-tree.c -lm 0.60u 0.00s 0.59r
- gccgo -O2 binary-tree.go 1.53u 0.00s 1.52r
- gccgo -O2 binary-tree-freelist.go 0.01u 0.00s 0.00r
- gc binary-tree 1.93u 0.02s 1.95r
- gc binary-tree-freelist 0.32u 0.01s 0.32r
-
-fannkuch 12
-OLD:
- gcc -O2 fannkuch.c 57.64u 0.00s 57.64r
- gccgo -O2 fannkuch.go 65.56u 0.01s 65.65r
- gccgo -O2 fannkuch-parallel.go 179.12u 0.00s 49.82r
- gc fannkuch 126.39u 0.00s 126.39r
- gc fannkuch-parallel 172.49u 0.02s 45.44r
- gc_B fannkuch 89.30u 0.00s 89.28r
-NEW:
- gcc -O2 fannkuch.c 45.17u 0.00s 45.26r
- gccgo -O2 fannkuch.go 53.63u 0.00s 53.73r
- gccgo -O2 fannkuch-parallel.go 216.72u 0.00s 58.42r
- gc fannkuch 108.21u 0.00s 108.44r
- gc fannkuch-parallel 227.20u 0.00s 57.27r
- gc_B fannkuch 56.14u 0.00s 56.26r
-
-regex-dna 100000
-OLD:
- gcc -O2 regex-dna.c -lpcre 0.77u 0.01s 0.78r
- gccgo -O2 regex-dna.go 10.15u 0.02s 10.23r
- gccgo -O2 regex-dna-parallel.go 33.81u 3.22s 11.62r
- gc regex-dna 6.52u 0.04s 6.56r
- gc regex-dna-parallel 6.84u 0.03s 2.70r
- gc_B regex-dna 6.83u 0.01s 6.84r
-NEW:
- gcc -O2 regex-dna.c -lpcre 0.47u 0.00s 0.47r
- gccgo -O2 regex-dna.go 6.00u 0.00s 6.00r
- gccgo -O2 regex-dna-parallel.go 44.54u 1.57s 6.51r
- gc regex-dna 5.41u 0.01s 5.42r
- gc regex-dna-parallel 5.62u 0.01s 2.20r
- gc_B regex-dna 5.50u 0.00s 5.50r
-
-spectral-norm 5500
-OLD:
- gcc -O2 spectral-norm.c -lm 12.29u 0.00s 12.28r
- gccgo -O2 spectral-norm.go 11.56u 0.00s 11.55r
- gc spectral-norm 23.98u 0.00s 24.00r
- gc_B spectral-norm 24.62u 0.00s 24.65r
-NEW:
- gcc -O2 spectral-norm.c -lm 15.79u 0.00s 15.82r
- gccgo -O2 spectral-norm.go 15.32u 0.00s 15.35r
- gc spectral-norm 19.62u 0.01s 19.67r
- gc_B spectral-norm 19.62u 0.00s 19.66r
-
-k-nucleotide 1000000
-OLD:
- gcc -O2 k-nucleotide.c 9.82u 0.06s 9.87r
- gccgo -O2 k-nucleotide.go 8.30u 0.02s 8.32r
- gccgo -O2 k-nucleotide-parallel.go 8.84u 0.05s 3.02r
- gc k-nucleotide 15.38u 0.07s 15.44r
- gc k-nucleotide-parallel 16.40u 0.03s 5.93r
- gc_B k-nucleotide 15.19u 0.05s 15.23r
-NEW:
- gcc -O2 -k-nucleotide.c 4.88u 0.03s 4.92r
- gccgo -O2 k-nucleotide.go 5.94u 0.01s 5.96r
- gccgo -O2 k-nucleotide-parallel.go 6.44u 0.03s 1.47r
- gc k-nucleotide 9.61u 0.01s 9.63r
- gc k-nucleotide-parallel 9.70u 0.00s 3.39r
- gc_B k-nucleotide 9.19u 0.03s 9.23r
-
-mandelbrot 16000
-OLD:
- gcc -O2 mandelbrot.c 54.54u 0.00s 54.56r
- gccgo -O2 mandelbrot.go 59.63u 0.03s 59.67r
- gc mandelbrot 64.82u 0.00s 64.83r
- gc_B mandelbrot 64.84u 0.00s 64.91r
-NEW:
- gcc -O2 mandelbrot.c 36.07u 0.01s 36.15r
- gccgo -O2 mandelbrot.go 43.57u 0.00s 43.66r
- gc mandelbrot 60.66u 0.00s 60.79r
- gc_B mandelbrot 60.90u 0.00s 61.03r
-
-meteor 2098
-OLD:
- gcc -O2 meteor-contest.c 0.11u 0.00s 0.10r
- gccgo -O2 meteor-contest.go 0.10u 0.01s 0.10r
- gc meteor-contest 0.18u 0.00s 0.17r
- gc_B meteor-contest 0.17u 0.00s 0.16r
-NEW:
- gcc -O2 meteor-contest.c 0.10u 0.00s 0.09r
- gccgo -O2 meteor-contest.go 0.10u 0.00s 0.09r
- gc meteor-contest 0.14u 0.00s 0.14r
- gc_B meteor-contest 0.13u 0.00s 0.13r
-
-pidigits 10000
-OLD:
- gcc -O2 pidigits.c -lgmp 2.22u 0.00s 2.21r
- gccgo -O2 pidigits.go 13.39u 0.00s 13.40r
- gc pidigits 6.42u 0.04s 6.45r
- gc_B pidigits 6.45u 0.02s 6.47r
-NEW:
- gcc -O2 pidigits.c -lgmp 2.27u 0.00s 2.29r
- gccgo -O2 pidigits.go 9.21u 0.00s 9.22r
- gc pidigits 3.60u 0.00s 3.60r
- gc_B pidigits 3.56u 0.02s 3.58r
-
-threadring 50000000
-OLD:
- gcc -O2 threadring.c -lpthread 34.51u 267.95s 336.12r
- gccgo -O2 threadring.go 103.51u 588.57s 627.16r
- gc threadring 54.68u 0.00s 54.73r
-NEW:
- gcc -O2 threadring.c 32.00u 259.39s 369.74r
- gccgo -O2 threadring.go 133.06u 546.02s 595.33r
- gc threadring 16.75u 0.02s 16.80r
-
-chameneos 6000000
-OLD:
- gcc -O2 chameneosredux.c -lpthread 12.65u 31.02s 13.33r
- gccgo -O2 chameneosredux.go 47.04u 302.84s 252.29r
- gc chameneosredux 14.14u 0.00s 14.14r
-NEW:
- gcc -O2 chameneosredux.c -lpthread 8.05u 63.43s 11.16r
- gccgo -O2 chameneosredux.go 82.95u 304.37s 207.64r
- gc chameneosredux 9.42u 0.00s 9.43r
-
-# May 13, 2011
-# after gc update to inline append when possible - 35% faster
-
-regex-dna 100000
- gc regex-dna 3.94u 0.00s 3.95r
- gc regex-dna-parallel 4.15u 0.01s 1.63r
- gc_B regex-dna 4.01u 0.01s 4.02r
-
-# Aug 4, 2011
-# After various updates to locking code and some runtime changes.
-# Slowdowns believed due to slower (but more correct) memmove.
-
-fannkuch 12
- gccgo -O2 fannkuch.go 51.59u 0.00s 51.69r # -4%
- gccgo -O2 fannkuch-parallel.go 253.17u 0.00s 64.67r # -11%
- gc fannkuch 103.14u 0.00s 103.36r # -5%
- gc fannkuch-parallel 189.63u 0.00s 49.37r # +9%
- gc_B fannkuch 49.19u 0.00s 49.29r # -14%
-
-regex-dna 100000
- gc regex-dna 3.78u 0.00s 3.78r # -43%
- gc regex-dna-parallel 3.84u 0.02s 1.48r # -49%
- gc_B regex-dna 3.62u 0.00s 3.63r # -52%
-
-k-nucleotide 1000000
- gc k-nucleotide 12.23u 0.02s 12.27r # +27%
- gc k-nucleotide-parallel 12.76u 0.02s 4.37r # +29%
- gc_B k-nucleotide 12.18u 0.01s 12.21r # +33%
-
-threadring 50000000
- gc threadring 17.49u 0.00s 17.53r # +4%
-
-chameneos 6000000
- gc chameneosredux 7.61u 0.00s 7.63r # -24%
-
-Aug 9, 2011
-# After custom algorithms for 1- 2- 4- 8-byte scalars.
-
-fannkuch 12
- gc fannkuch-parallel 157.17u 0.00s 41.08r # -17%
-
-k-nucleotide 1000000
- gc k-nucleotide 8.72u 0.03s 8.76r # -39%
- gc k-nucleotide-parallel 8.79u 0.01s 3.14r # -39%
- gc_B k-nucleotide 8.65u 0.03s 8.69r # -39%
-
-pidigits 10000
- gc pidigits 3.71u 0.02s 3.73r # +4%
- gc_B pidigits 3.73u 0.00s 3.73r # +4%
-
-threadring 50000000
- gc threadring 14.51u 0.00s 14.54r # -17%
-
-chameneos 6000000
- gc chameneosredux 7.41u 0.00s 7.42r # -3%
-
-# A complete run at the Go 1 release.
-# Significant changes:
-# - gccgo is now enabled for all tests (goroutines are cheap enough)
-# - threadring and chameneos are 14% faster, probably due to runtime changes
-# - regex-dna 36% faster
-# - fannkuch-parallel (only) slowed down 40%
-# - gccgo on binary-tree-freelist is still optimized to nothing
-# Other changes are modest.
-
-fasta -n 25000000
- gcc -O2 fasta.c 1.45u 0.02s 1.48r
- gccgo -O2 fasta.go 1.46u 0.00s 1.47r
- gc fasta 1.99u 0.01s 2.00r
- gc_B fasta 1.99u 0.01s 2.01r
-
-reverse-complement < output-of-fasta-25000000
- gcc -O2 reverse-complement.c 0.95u 0.48s 4.99r
- gccgo -O2 reverse-complement.go 0.93u 0.16s 1.09r
- gc reverse-complement 1.20u 0.19s 1.39r
- gc_B reverse-complement 1.04u 0.16s 1.20r
-
-nbody -n 50000000
- gcc -O2 -lm nbody.c 13.02u 0.00s 13.05r
- gccgo -O2 nbody.go 14.46u 0.00s 14.49r
- gc nbody 21.79u 0.00s 21.84r
- gc_B nbody 21.74u 0.00s 21.79r
-
-binary-tree 15 # too slow to use 20
- gcc -O2 binary-tree.c -lm 0.60u 0.01s 0.61r
- gccgo -O2 binary-tree.go 1.30u 0.01s 1.32r
- gccgo -O2 binary-tree-freelist.go 0.00u 0.00s 0.00r
- gc binary-tree 1.84u 0.01s 1.86r
- gc binary-tree-freelist 0.33u 0.00s 0.33r
-
-fannkuch 12
- gcc -O2 fannkuch.c 45.24u 0.00s 45.34r
- gccgo -O2 fannkuch.go 59.76u 0.01s 59.90r
- gccgo -O2 fannkuch-parallel.go 218.20u 0.01s 61.60r
- gc fannkuch 103.92u 0.00s 104.16r
- gc fannkuch-parallel 221.61u 0.00s 60.49r
- gc_B fannkuch 53.17u 0.00s 53.30r
-
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.47u 0.00s 0.48r
- gccgo -O2 regex-dna.go 6.52u 0.00s 6.54r
- gccgo -O2 regex-dna-parallel.go 14.40u 0.73s 4.35r
- gc regex-dna 2.63u 0.02s 2.66r # -36%
- gc regex-dna-parallel 2.87u 0.01s 1.11r
- gc_B regex-dna 2.65u 0.00s 2.66r
-
-spectral-norm 5500
- gcc -O2 spectral-norm.c -lm 15.78u 0.00s 15.82r
- gccgo -O2 spectral-norm.go 15.79u 0.00s 15.83r
- gc spectral-norm 19.76u 0.00s 19.80r
- gc_B spectral-norm 19.73u 0.01s 19.78r
-
-k-nucleotide 1000000
- gcc -O2 k-nucleotide.c 5.59u 0.03s 5.63r
- gccgo -O2 k-nucleotide.go 4.09u 0.03s 4.13r
- gccgo -O2 k-nucleotide-parallel.go 4.50u 0.06s 1.63r
- gc k-nucleotide 9.23u 0.02s 9.27r
- gc k-nucleotide-parallel 9.87u 0.03s 3.55r
- gc_B k-nucleotide 9.20u 0.00s 9.22r
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 36.09u 0.00s 36.18r
- gccgo -O2 mandelbrot.go 41.69u 0.01s 41.80r
- gc mandelbrot 60.91u 0.02s 61.07r
- gc_B mandelbrot 60.90u 0.00s 61.04r
-
-meteor 2098
- gcc -O2 meteor-contest.c 0.09u 0.00s 0.09r
- gccgo -O2 meteor-contest.go 0.09u 0.00s 0.09r
- gc meteor-contest 0.14u 0.00s 0.15r
- gc_B meteor-contest 0.14u 0.00s 0.14r
-
-pidigits 10000
- gcc -O2 pidigits.c -lgmp 2.27u 0.00s 2.27r
- gccgo -O2 pidigits.go 8.65u 0.00s 8.67r
- gc pidigits 3.70u 0.04s 3.75r
- gc_B pidigits 3.72u 0.02s 3.75r
-
-threadring 50000000
- gcc -O2 threadring.c 40.91u 369.85s 323.31r
- gccgo -O2 threadring.go 26.97u 30.82s 57.93r
- gc threadring 12.81u 0.01s 12.85r # -13%
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 9.44u 72.90s 12.65r
- gccgo -O2 chameneosredux.go 7.73u 7.53s 15.30r
- gc chameneosredux 6.51u 0.00s 6.53r # - 14%
-
-# After http://codereview.appspot.com/6248049, moving panicindex
-# calls out of line (putting the likely code into a single path and shortening
-# loops). Significant changes since the last run (note: some are slower for
-# unrelated and as yet undiagnosed reasons):
-
-nbody -n 50000000
- gc nbody 19.10u 0.01s 19.19r # -12%
- gc_B nbody 19.19u 0.00s 19.23r # -12%
-
-binary-tree 15 # too slow to use 20
- gc binary-tree 1.49u 0.01s 1.51r # -19%
-
-fannkuch 12
- gc fannkuch 60.79u 0.00s 60.92r # -41%
- gc fannkuch-parallel 183.51u 0.01s 51.75r # -14%
- gc_B fannkuch 51.68u 0.00s 51.79r # -3%
-
-k-nucleotide 1000000
- gc k-nucleotide 9.74u 0.04s 9.80r # +6%
- gc k-nucleotide-parallel 9.89u 0.05s 3.59r # +1%
- gc_B k-nucleotide 9.39u 0.02s 9.43r # +2%
-
-mandelbrot (much slower, due to unrelated http://codereview.appspot.com/6209077)
- gc mandelbrot 100.98u 0.00s 101.20r # +65%
- gc_B mandelbrot 100.90u 0.01s 101.17r # +65%
-
-meteor 2098
- gc meteor-contest 0.13u 0.00s 0.13r # -13%
- gc_B meteor-contest 0.13u 0.00s 0.13r # -7%
-
-# May 30, 2012.
-# After http://codereview.appspot.com/6261051, restoring old code generated
-# for floating-point constants. Mandelbrot is back to its previous numbers.
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 36.07u 0.00s 36.16r
- gccgo -O2 mandelbrot.go 41.72u 0.01s 41.90r
- gc mandelbrot 60.62u 0.00s 60.76r
- gc_B mandelbrot 60.68u 0.00s 60.82r
-
-# May 30, 2012.
-# After http://codereview.appspot.com/6248068, better FP code
-# by avoiding MOVSD between registers.
-# Plus some other timing changes that have crept in from other speedups,
-# from garbage collection to Printf.
-
-fasta -n 25000000
- gc fasta 1.76u 0.00s 1.76r # -12%
- gc_B fasta 1.71u 0.00s 1.72r # -12%
-
-nbody -n 50000000
- gc nbody 17.56u 0.00s 17.60r # -8%
- gc_B nbody 17.30u 0.00s 17.34r # -10%
-
-fannkuch 12
- gc fannkuch-parallel 155.92u 0.01s 44.05r # -15%
-
-k-nucleotide 1000000
- gc k-nucleotide 9.22u 0.01s 9.26r # -5%
- gc k-nucleotide-parallel 9.23u 0.03s 3.26r # -9%
- gc_B k-nucleotide 9.22u 0.03s 9.28r # -2%
-
-mandelbrot 16000
- gc mandelbrot 44.80u 0.00s 44.90r # -27%
- gc_B mandelbrot 44.81u 0.00s 44.92r # -26%
-
-pidigits 10000
- gc pidigits 3.51u 0.00s 3.52r # -6%
- gc_B pidigits 3.51u 0.00s 3.52r # -6%
-
-# Aug 28, 2012
-# After some assembler work in package big.
-pidigits 10000
- gc pidigits 2.85u 0.02s 2.88r # -22%
- gc_B pidigits 2.88u 0.01s 2.90r # -21%
-
-# Sep 26, 2012
-# 64-bit ints, plus significantly better floating-point code.
-# Interesting details:
-# Generally something in the 0-10% slower range, some (binary tree) more
-# Floating-point noticeably faster:
-# nbody -25%
-# mandelbrot -37% relative to Go 1.
-# Other:
-# regex-dna +47%
-fasta -n 25000000
- gcc -O2 fasta.c 1.43u 0.03s 1.46r
- gccgo -O2 fasta.go 1.47u 0.00s 1.47r
- gc fasta 1.78u 0.01s 1.80r
- gc_B fasta 1.76u 0.00s 1.76r
-
-reverse-complement < output-of-fasta-25000000
- gcc -O2 reverse-complement.c 1.14u 0.39s 11.19r
- gccgo -O2 reverse-complement.go 0.91u 0.17s 1.09r
- gc reverse-complement 1.12u 0.18s 1.31r
- gc_B reverse-complement 1.12u 0.15s 1.28r
-
-nbody -n 50000000
- gcc -O2 nbody.c -lm 13.02u 0.00s 13.05r
- gccgo -O2 nbody.go 13.90u 0.00s 13.93r
- gc nbody 17.05u 0.00s 17.09r
- gc_B nbody 16.30u 0.00s 16.34r
-
-binary-tree 15 # too slow to use 20
- gcc -O2 binary-tree.c -lm 0.61u 0.00s 0.61r
- gccgo -O2 binary-tree.go 1.24u 0.04s 1.29r
- gccgo -O2 binary-tree-freelist.go 0.21u 0.01s 0.22r
- gc binary-tree 1.93u 0.02s 1.96r
- gc binary-tree-freelist 0.32u 0.00s 0.33r
-
-fannkuch 12
- gcc -O2 fannkuch.c 45.19u 0.00s 45.29r
- gccgo -O2 fannkuch.go 60.32u 0.00s 60.45r
- gccgo -O2 fannkuch-parallel.go 185.59u 0.00s 59.49r
- gc fannkuch 72.14u 0.00s 72.30r
- gc fannkuch-parallel 172.54u 0.00s 43.59r
- gc_B fannkuch 53.55u 0.00s 53.67r
-
-regex-dna 100000
- gcc -O2 regex-dna.c -lpcre 0.47u 0.00s 0.47r
- gccgo -O2 regex-dna.go 6.49u 0.05s 6.56r
- gccgo -O2 regex-dna-parallel.go 14.60u 0.67s 4.42r
- gc regex-dna 3.91u 0.00s 3.92r
- gc regex-dna-parallel 4.01u 0.03s 1.56r
- gc_B regex-dna 3.91u 0.00s 3.92r
-
-spectral-norm 5500
- gcc -O2 spectral-norm.c -lm 15.85u 0.00s 15.89r
- gccgo -O2 spectral-norm.go 15.86u 0.00s 15.89r
- gc spectral-norm 19.72u 0.00s 19.76r
- gc_B spectral-norm 19.68u 0.01s 19.74r
-
-k-nucleotide 1000000
- gcc -O2 k-nucleotide.c -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -lglib-2.0 4.90u 0.01s 4.93r
- gccgo -O2 k-nucleotide.go 4.78u 0.01s 4.80r
- gccgo -O2 k-nucleotide-parallel.go 6.49u 0.02s 2.18r
- gc k-nucleotide 9.05u 0.02s 9.09r
- gc k-nucleotide-parallel 9.27u 0.01s 3.29r
- gc_B k-nucleotide 8.95u 0.03s 9.00r
-
-mandelbrot 16000
- gcc -O2 mandelbrot.c 36.11u 0.00s 36.19r
- gccgo -O2 mandelbrot.go 43.67u 0.00s 43.77r
- gc mandelbrot 38.57u 0.00s 38.66r
- gc_B mandelbrot 38.59u 0.00s 38.68r
-
-meteor 2098
- gcc -O2 meteor-contest.c 0.09u 0.00s 0.09r
- gccgo -O2 meteor-contest.go 0.09u 0.00s 0.09r
- gc meteor-contest 0.13u 0.00s 0.14r
- gc_B meteor-contest 0.12u 0.00s 0.13r
-
-pidigits 10000
- gcc -O2 pidigits.c -lgmp 2.26u 0.00s 2.27r
- gccgo -O2 pidigits.go 9.05u 0.00s 9.07r
- gc pidigits 2.88u 0.02s 2.90r
- gc_B pidigits 2.89u 0.00s 2.90r
-
-threadring 50000000
- gcc -O2 threadring.c -lpthread 37.30u 327.81s 289.28r
- gccgo -O2 threadring.go 42.83u 26.15s 69.14r
- gc threadring 13.00u 0.00s 13.03r
-
-chameneos 6000000
- gcc -O2 chameneosredux.c -lpthread 8.80u 71.67s 12.19r
- gccgo -O2 chameneosredux.go 11.28u 6.68s 18.00r
- gc chameneosredux 6.94u 0.00s 6.96r
-
-# May 23, 2013
-# Go 1.1, which includes precise GC, new scheduler, faster maps.
-# 20%-ish speedups across many benchmarks.
-# gccgo showing significant improvement (even though it's not yet up to Go 1.1)
-#
-# Standouts:
-# fannkuch, regex-dna, k-nucleotide, threadring, chameneos
-
-fasta -n 25000000
- gcc -m64 -O2 fasta.c 1.54u 0.01s 1.55r
- gccgo -O2 fasta.go 1.42u 0.00s 1.43r
- gc fasta 1.50u 0.01s 1.52r # -16%
- gc_B fasta 1.46u 0.00s 1.46r # -17%
-
-reverse-complement < output-of-fasta-25000000
- gcc -m64 -O2 reverse-complement.c 0.87u 0.37s 4.36r
- gccgo -O2 reverse-complement.go 0.77u 0.15s 0.93r # -15%
- gc reverse-complement 0.99u 0.12s 1.12r # -15%
- gc_B reverse-complement 0.85u 0.17s 1.02r # -21%
-
-nbody -n 50000000
- gcc -m64 -O2 nbody.c -lm 13.50u 0.00s 13.53r
- gccgo -O2 nbody.go 13.98u 0.01s 14.02r
- gc nbody 16.63u 0.01s 16.67r
- gc_B nbody 15.74u 0.00s 15.76r
-
-binary-tree 15 # too slow to use 20
- gcc -m64 -O2 binary-tree.c -lm 0.61u 0.00s 0.61r
- gccgo -O2 binary-tree.go 1.11u 0.01s 1.12r # -13%
- gccgo -O2 binary-tree-freelist.go 0.22u 0.01s 0.23r
- gc binary-tree 1.83u 0.02s 1.83r # -7%
- gc binary-tree-freelist 0.32u 0.00s 0.32r
-
-fannkuch 12
- gcc -m64 -O2 fannkuch.c 45.56u 0.00s 45.67r
- gccgo -O2 fannkuch.go 57.71u 0.00s 57.85r # -4%
- gccgo -O2 fannkuch-parallel.go 146.31u 0.00s 37.50r #-37%
- gc fannkuch 70.06u 0.03s 70.17r # -3%
- gc fannkuch-parallel 131.88u 0.06s 33.59r # -23%
- gc_B fannkuch 45.55u 0.02s 45.63r # -15%
-
-regex-dna 100000
- gcc -m64 -O2 regex-dna.c -lpcre 0.44u 0.01s 0.45r
- gccgo -O2 regex-dna.go 5.59u 0.00s 5.61r # -14%
- gccgo -O2 regex-dna-parallel.go 10.85u 0.30s 3.34r # -24%
- gc regex-dna 2.23u 0.01s 2.25r # -43%
- gc regex-dna-parallel 2.35u 0.00s 0.93r # -40%
- gc_B regex-dna 2.24u 0.01s 2.25r # -43%
-
-spectral-norm 5500
- gcc -m64 -O2 spectral-norm.c -lm 14.84u 0.00s 14.88r
- gccgo -O2 spectral-norm.go 15.33u 0.00s 15.37r
- gc spectral-norm 16.75u 0.02s 16.79r # -15%
- gc_B spectral-norm 16.77u 0.01s 16.79r # -15%
-
-k-nucleotide 1000000
- gcc -O2 k-nucleotide.c -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -lglib-2.0 4.50u 0.00s 4.52r
- gccgo -O2 k-nucleotide.go 3.72u 0.04s 3.77r # -21%
- gccgo -O2 k-nucleotide-parallel.go 3.88u 0.03s 1.42r # -35%
- gc k-nucleotide 6.32u 0.01s 6.33r # -31%
- gc k-nucleotide-parallel 6.47u 0.05s 2.13r # -33%
- gc_B k-nucleotide 6.45u 0.01s 6.47r # - 28%
-
-mandelbrot 16000
- gcc -m64 -O2 mandelbrot.c 36.03u 0.00s 36.11r
- gccgo -O2 mandelbrot.go 37.61u 0.00s 37.74r # -14%
- gc mandelbrot 38.19u 0.05s 38.29r
- gc_B mandelbrot 38.19u 0.03s 38.26r
-
-meteor 2098
- gcc -m64 -O2 meteor-contest.c 0.08u 0.00s 0.08r
- gccgo -O2 meteor-contest.go 0.09u 0.01s 0.10r
- gc meteor-contest 0.12u 0.00s 0.12r # -15% although perhaps just noise
- gc_B meteor-contest 0.11u 0.00s 0.12r # -8% although perhaps just noise
-
-pidigits 10000
- gcc -m64 -O2 pidigits.c -lgmp 2.27u 0.00s 2.28r
- gccgo -O2 pidigits.go 8.95u 0.02s 8.99r
- gc pidigits 2.88u 0.14s 2.91r
- gc_B pidigits 2.92u 0.10s 2.91r
-
-threadring 50000000
- gcc -m64 -O2 threadring.c -lpthread 14.75u 167.88s 212.23r
- gccgo -O2 threadring.go 36.72u 12.08s 48.91r # -29%
- gc threadring 10.93u 0.01s 10.95r # -16%
-
-chameneos 6000000
- gcc -m64 -O2 chameneosredux.c -lpthread 8.89u 56.62s 9.75r
- gccgo -O2 chameneosredux.go 9.48u 2.48s 11.99r # -33%
- gc chameneosredux 5.80u 0.00s 5.81r # -16%
-
diff --git a/test/bench/shootout/timing.sh b/test/bench/shootout/timing.sh
deleted file mode 100755
index 9abcf78..0000000
--- a/test/bench/shootout/timing.sh
+++ /dev/null
@@ -1,252 +0,0 @@
-#!/usr/bin/env bash
-# Copyright 2009 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.
-
-set -e
-
-eval $(go tool dist env)
-GC="go tool compile"
-LD="go tool link"
-
-gccm=""
-case "$O" in
-8)
- gccm=-m32;;
-6)
- gccm=-m64;;
-esac
-
-EXE="out"
-havepcre=true
-haveglib=true
-havegmp=true
-case "$(uname)" in
-*MINGW* | *WIN32* | *CYGWIN*)
- havepcre=false
- haveglib=false
- havegmp=false
- if which pkg-config >/dev/null 2>&1; then
- if pkg-config --cflags libpcre >/dev/null 2>&1
- then
- echo "havepcre"
- havepcre=true
- fi
- if pkg-config --cflags glib-2.0 >/dev/null 2>&1
- then
- haveglib=true
- fi
- if pkg-config --cflags gmp >/dev/null 2>&1
- then
- havegmp=true
- fi
- fi
- EXE=exe;;
-esac
-
-PATH=.:$PATH
-
-havegccgo=false
-if which gccgo >/dev/null 2>&1
-then
- havegccgo=true
-fi
-
-mode=run
-case X"$1" in
-X-test)
- mode=test
- shift
-esac
-
-gc() {
- $GC $1.go; $LD -o a.$EXE $1.o
-}
-
-gc_B() {
- $GC -B $1.go; $LD -o a.$EXE $1.o
-}
-
-runonly() {
- if [ $mode = run ]
- then
- "$@"
- fi
-}
-
-run() {
- if [ $mode = test ]
- then
- if echo $1 | grep -q '^gc '
- then
- $1 # compile the program
- program=$(echo $1 | sed 's/gc //')
- shift
- echo $program
- $1 <fasta-1000.txt > /tmp/$$
- case $program in
- chameneosredux)
- # exact numbers may vary but non-numbers should match
- grep -v '[0-9]' /tmp/$$ > /tmp/$$x
- grep -v '[0-9]' chameneosredux.txt > /tmp/$$y
- cmp /tmp/$$x /tmp/$$y
- rm -f /tmp/$$ /tmp/$$x /tmp/$$y
- ;;
- *)
- cmp /tmp/$$ $program.txt
- rm -f /tmp/$$
- esac
- fi
- return
- fi
- if ! $havegccgo && echo $1 | grep -q '^gccgo '
- then
- return
- fi
- echo -n ' '$1' '
- $1
- shift
-
- echo $((time -p $* >/dev/null) 2>&1) | awk '{print $4 "u " $6 "s " $2 "r"}'
-}
-
-fasta() {
- runonly echo 'fasta -n 25000000'
- run "gcc $gccm -O2 fasta.c" a.$EXE 25000000
- run 'gccgo -O2 fasta.go' a.$EXE -n 25000000 #commented out until WriteString is in bufio
- run 'gc fasta' a.$EXE -n 25000000
- run 'gc_B fasta' a.$EXE -n 25000000
-}
-
-revcomp() {
- runonly gcc -O2 fasta.c
- runonly a.$EXE 25000000 > x
- runonly echo 'reverse-complement < output-of-fasta-25000000'
- run "gcc $gccm -O2 reverse-complement.c" a.$EXE < x
- run 'gccgo -O2 reverse-complement.go' a.$EXE < x
- run 'gc reverse-complement' a.$EXE < x
- run 'gc_B reverse-complement' a.$EXE < x
- rm x
-}
-
-nbody() {
- runonly echo 'nbody -n 50000000'
- run "gcc $gccm -O2 nbody.c -lm" a.$EXE 50000000
- run 'gccgo -O2 nbody.go' a.$EXE -n 50000000
- run 'gc nbody' a.$EXE -n 50000000
- run 'gc_B nbody' a.$EXE -n 50000000
-}
-
-binarytree() {
- runonly echo 'binary-tree 15 # too slow to use 20'
- run "gcc $gccm -O2 binary-tree.c -lm" a.$EXE 15
- run 'gccgo -O2 binary-tree.go' a.$EXE -n 15
- run 'gccgo -O2 binary-tree-freelist.go' a.$EXE -n 15
- run 'gc binary-tree' a.$EXE -n 15
- run 'gc binary-tree-freelist' a.$EXE -n 15
-}
-
-fannkuch() {
- runonly echo 'fannkuch 12'
- run "gcc $gccm -O2 fannkuch.c" a.$EXE 12
- run 'gccgo -O2 fannkuch.go' a.$EXE -n 12
- run 'gccgo -O2 fannkuch-parallel.go' a.$EXE -n 12
- run 'gc fannkuch' a.$EXE -n 12
- run 'gc fannkuch-parallel' a.$EXE -n 12
- run 'gc_B fannkuch' a.$EXE -n 12
-}
-
-regexdna() {
- runonly gcc -O2 fasta.c
- runonly a.$EXE 100000 > x
- runonly echo 'regex-dna 100000'
- if $havepcre; then
- run "gcc $gccm -O2 regex-dna.c $(pkg-config libpcre --cflags --libs)" a.$EXE <x
- fi
- run 'gccgo -O2 regex-dna.go' a.$EXE <x
- run 'gccgo -O2 regex-dna-parallel.go' a.$EXE <x
- run 'gc regex-dna' a.$EXE <x
- run 'gc regex-dna-parallel' a.$EXE <x
- run 'gc_B regex-dna' a.$EXE <x
- rm x
-}
-
-spectralnorm() {
- runonly echo 'spectral-norm 5500'
- run "gcc $gccm -O2 spectral-norm.c -lm" a.$EXE 5500
- run 'gccgo -O2 spectral-norm.go' a.$EXE -n 5500
- run 'gc spectral-norm' a.$EXE -n 5500
- run 'gc_B spectral-norm' a.$EXE -n 5500
-}
-
-knucleotide() {
- runonly gcc -O2 fasta.c
- runonly a.$EXE 1000000 > x # should be using 25000000
- runonly echo 'k-nucleotide 1000000'
- if [ $mode = run ] && $haveglib; then
- run "gcc -O2 k-nucleotide.c $(pkg-config glib-2.0 --cflags --libs)" a.$EXE <x
- fi
- run 'gccgo -O2 k-nucleotide.go' a.$EXE <x
- run 'gccgo -O2 k-nucleotide-parallel.go' a.$EXE <x
- run 'gc k-nucleotide' a.$EXE <x
- run 'gc k-nucleotide-parallel' a.$EXE <x
- run 'gc_B k-nucleotide' a.$EXE <x
- rm x
-}
-
-mandelbrot() {
- runonly echo 'mandelbrot 16000'
- run "gcc $gccm -O2 mandelbrot.c" a.$EXE 16000
- run 'gccgo -O2 mandelbrot.go' a.$EXE -n 16000
- run 'gc mandelbrot' a.$EXE -n 16000
- run 'gc_B mandelbrot' a.$EXE -n 16000
-}
-
-meteor() {
- runonly echo 'meteor 2098'
- run "gcc $gccm -O2 meteor-contest.c" a.$EXE 2098
- run 'gccgo -O2 meteor-contest.go' a.$EXE -n 2098
- run 'gc meteor-contest' a.$EXE -n 2098
- run 'gc_B meteor-contest' a.$EXE -n 2098
-}
-
-pidigits() {
- runonly echo 'pidigits 10000'
- if $havegmp; then
- run "gcc $gccm -O2 pidigits.c -lgmp" a.$EXE 10000
- fi
- run 'gccgo -O2 pidigits.go' a.$EXE -n 10000
- run 'gc pidigits' a.$EXE -n 10000
- run 'gc_B pidigits' a.$EXE -n 10000
-}
-
-threadring() {
- runonly echo 'threadring 50000000'
- run "gcc $gccm -O2 threadring.c -lpthread" a.$EXE 50000000
- run 'gccgo -O2 threadring.go' a.$EXE -n 50000000
- run 'gc threadring' a.$EXE -n 50000000
-}
-
-chameneos() {
- runonly echo 'chameneos 6000000'
- run "gcc $gccm -O2 chameneosredux.c -lpthread" a.$EXE 6000000
- run 'gccgo -O2 chameneosredux.go' a.$EXE 6000000
- run 'gc chameneosredux' a.$EXE 6000000
-}
-
-case $# in
-0)
- run="fasta revcomp nbody binarytree fannkuch regexdna spectralnorm knucleotide mandelbrot meteor pidigits threadring chameneos"
- ;;
-*)
- run=$*
-esac
-
-for i in $run
-do
- $i
- runonly echo
-done
-
-rm *.o *.$EXE # Clean up
-
diff --git a/test/blank1.go b/test/blank1.go
index 54a7297..bf94d1a 100644
--- a/test/blank1.go
+++ b/test/blank1.go
@@ -13,6 +13,10 @@
_ int
}
+func (x int) _() { // ERROR "cannot define new methods on non-local type"
+ println(x)
+}
+
type T struct {
_ []int
}
diff --git a/test/bombad.go b/test/bombad.go
index b894d9b..6b79a98 100644
--- a/test/bombad.go
+++ b/test/bombad.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/bounds.go b/test/bounds.go
index 50f7ad7..a0febb5 100644
--- a/test/bounds.go
+++ b/test/bounds.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/bugs/bug395.go b/test/bugs/bug395.go
index 5490a3d..4fe81e0 100644
--- a/test/bugs/bug395.go
+++ b/test/bugs/bug395.go
@@ -2,7 +2,7 @@
// When issue 1909 is fixed, change from skip to compile.
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/chan/select2.go b/test/chan/select2.go
index ccf9dab..31e27d7 100644
--- a/test/chan/select2.go
+++ b/test/chan/select2.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/chan/select5.go b/test/chan/select5.go
index cfdc085..8b98c3a 100644
--- a/test/chan/select5.go
+++ b/test/chan/select5.go
@@ -1,6 +1,6 @@
// runoutput
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/chan/select6.go b/test/chan/select6.go
index af470a0..6e8129f 100644
--- a/test/chan/select6.go
+++ b/test/chan/select6.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/chan/select7.go b/test/chan/select7.go
index 20456a9..f7222ca 100644
--- a/test/chan/select7.go
+++ b/test/chan/select7.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/chan/sendstmt.go b/test/chan/sendstmt.go
index a92c4f6..278fa1b 100644
--- a/test/chan/sendstmt.go
+++ b/test/chan/sendstmt.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/checkbce.go b/test/checkbce.go
new file mode 100644
index 0000000..fa0ea12
--- /dev/null
+++ b/test/checkbce.go
@@ -0,0 +1,114 @@
+// +build amd64
+// errorcheck -0 -d=ssa/check_bce/debug=3
+
+package main
+
+func f0(a []int) {
+ a[0] = 1 // ERROR "Found IsInBounds$"
+ a[0] = 1
+ a[6] = 1 // ERROR "Found IsInBounds$"
+ a[6] = 1
+ a[5] = 1
+ a[5] = 1
+}
+
+func f1(a [256]int, i int) {
+ useInt(a[i]) // ERROR "Found IsInBounds$"
+ useInt(a[i%256]) // ERROR "Found IsInBounds$"
+ useInt(a[i&255])
+ useInt(a[i&17])
+
+ if 4 <= i && i < len(a) {
+ useInt(a[i])
+ useInt(a[i-1]) // ERROR "Found IsInBounds$"
+ useInt(a[i-4]) // ERROR "Found IsInBounds$"
+ }
+}
+
+func f2(a [256]int, i uint) {
+ useInt(a[i]) // ERROR "Found IsInBounds$"
+ useInt(a[i%256])
+ useInt(a[i&255])
+ useInt(a[i&17])
+}
+
+func f3(a [256]int, i uint8) {
+ useInt(a[i])
+ useInt(a[i+10])
+ useInt(a[i+14])
+}
+
+func f4(a [27]int, i uint8) {
+ useInt(a[i%15])
+ useInt(a[i%19])
+ useInt(a[i%27])
+}
+
+func f5(a []int) {
+ if len(a) > 5 {
+ useInt(a[5])
+ useSlice(a[6:])
+ useSlice(a[:6]) // ERROR "Found IsSliceInBounds$"
+ }
+}
+
+func f6(a [32]int, b [64]int, i int) {
+ useInt(a[uint32(i*0x07C4ACDD)>>27])
+ useInt(b[uint64(i*0x07C4ACDD)>>58])
+ useInt(a[uint(i*0x07C4ACDD)>>59])
+
+ // The following bounds should not be removed because they can overflow.
+ useInt(a[uint32(i*0x106297f105d0cc86)>>26]) // ERROR "Found IsInBounds$"
+ useInt(b[uint64(i*0x106297f105d0cc86)>>57]) // ERROR "Found IsInBounds$"
+ useInt(a[int32(i*0x106297f105d0cc86)>>26]) // ERROR "Found IsInBounds$"
+ useInt(b[int64(i*0x106297f105d0cc86)>>57]) // ERROR "Found IsInBounds$"
+}
+
+func g1(a []int) {
+ for i := range a {
+ a[i] = i
+ useSlice(a[:i+1])
+ useSlice(a[:i])
+ }
+}
+
+func g2(a []int) {
+ useInt(a[3]) // ERROR "Found IsInBounds$"
+ useInt(a[2])
+ useInt(a[1])
+ useInt(a[0])
+}
+
+func g3(a []int) {
+ for i := range a[:256] { // ERROR "Found IsSliceInBounds$"
+ useInt(a[i]) // ERROR "Found IsInBounds$"
+ }
+ b := a[:256]
+ for i := range b {
+ useInt(b[i])
+ }
+}
+
+func g4(a [100]int) {
+ for i := 10; i < 50; i++ {
+ useInt(a[i-10])
+ useInt(a[i])
+ useInt(a[i+25])
+ useInt(a[i+50])
+
+ // The following are out of bounds.
+ useInt(a[i-11]) // ERROR "Found IsInBounds$"
+ useInt(a[i+51]) // ERROR "Found IsInBounds$"
+ }
+}
+
+//go:noinline
+func useInt(a int) {
+}
+
+//go:noinline
+func useSlice(a []int) {
+}
+
+func main() {
+}
diff --git a/test/cmplxdivide.c b/test/cmplxdivide.c
index d654362..a475cc2 100644
--- a/test/cmplxdivide.c
+++ b/test/cmplxdivide.c
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/cmplxdivide.go b/test/cmplxdivide.go
index 8e29672..a8ae515 100644
--- a/test/cmplxdivide.go
+++ b/test/cmplxdivide.go
@@ -1,6 +1,6 @@
// run cmplxdivide1.go
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/complit1.go b/test/complit1.go
index c7a2ac9..9dde994 100644
--- a/test/complit1.go
+++ b/test/complit1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/compos.go b/test/compos.go
index de688b3..e6375f2 100644
--- a/test/compos.go
+++ b/test/compos.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/const.go b/test/const.go
index d583659..6c29336 100644
--- a/test/const.go
+++ b/test/const.go
@@ -19,6 +19,9 @@
c3div2 = 3 / 2
c1e3 = 1e3
+ rsh1 = 1e100 >> 1000
+ rsh2 = 1e302 >> 1000
+
ctrue = true
cfalse = !ctrue
)
@@ -48,6 +51,8 @@
assert(c3div2 == 1, "3/2")
assert(c1e3 == 1000, "c1e3 int")
assert(c1e3 == 1e3, "c1e3 float")
+ assert(rsh1 == 0, "rsh1")
+ assert(rsh2 == 9, "rsh2")
// verify that all (in range) are assignable as ints
var i int
diff --git a/test/const6.go b/test/const6.go
index c005ac3..b340e58 100644
--- a/test/const6.go
+++ b/test/const6.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/convert1.go b/test/convert1.go
index 0f417a3..afb63cd 100644
--- a/test/convert1.go
+++ b/test/convert1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/ddd.go b/test/ddd.go
index 01768b8..84503f7 100644
--- a/test/ddd.go
+++ b/test/ddd.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/ddd1.go b/test/ddd1.go
index 07981af..7ea04f3 100644
--- a/test/ddd1.go
+++ b/test/ddd1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/ddd2.dir/ddd2.go b/test/ddd2.dir/ddd2.go
index c9a2675..f3f863c 100644
--- a/test/ddd2.dir/ddd2.go
+++ b/test/ddd2.dir/ddd2.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/ddd2.dir/ddd3.go b/test/ddd2.dir/ddd3.go
index 5486fe8..608091d 100644
--- a/test/ddd2.dir/ddd3.go
+++ b/test/ddd2.dir/ddd3.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/ddd2.go b/test/ddd2.go
index 0d9f634..612ba29 100644
--- a/test/ddd2.go
+++ b/test/ddd2.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/deferprint.go b/test/deferprint.go
index 72c98b1..3dc0854 100644
--- a/test/deferprint.go
+++ b/test/deferprint.go
@@ -1,6 +1,6 @@
// cmpout
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/divide.go b/test/divide.go
index b20f106..b557041 100644
--- a/test/divide.go
+++ b/test/divide.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/divmod.go b/test/divmod.go
index ad632bc..ab85b7f 100644
--- a/test/divmod.go
+++ b/test/divmod.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/eof.go b/test/eof.go
index 06c7790..d051f33 100644
--- a/test/eof.go
+++ b/test/eof.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/eof1.go b/test/eof1.go
index 2105b89..90792ca 100644
--- a/test/eof1.go
+++ b/test/eof1.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/errchk b/test/errchk
index b07bbc7..bc8ef19 100755
--- a/test/errchk
+++ b/test/errchk
@@ -37,6 +37,17 @@
}
}
+# If no files have been specified try to grab SOURCEFILES from the last
+# argument that is an existing directory if any
+unless(@file) {
+ foreach(reverse 0 .. @ARGV-1) {
+ if(-d $ARGV[$_]) {
+ @file = glob($ARGV[$_] . "/*.go");
+ last;
+ }
+ }
+}
+
foreach $file (@file) {
open(SRC, $file) || die "BUG: errchk: open $file: $!";
$src{$file} = [<SRC>];
diff --git a/test/escape2.go b/test/escape2.go
index 46cfde4..3490c29 100644
--- a/test/escape2.go
+++ b/test/escape2.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
@@ -620,15 +620,15 @@
}
func foo75(z *int) { // ERROR "foo75 z does not escape$"
- myprint(z, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo75 ... argument does not escape$"
+ myprint(z, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo75 ... argument does not escape$"
}
func foo75a(z *int) { // ERROR "foo75a z does not escape$"
- myprint1(z, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo75a ... argument does not escape$"
+ myprint1(z, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo75a ... argument does not escape$"
}
func foo75esc(z *int) { // ERROR "leaking param: z$"
- gxx = myprint(z, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo75esc ... argument does not escape$"
+ gxx = myprint(z, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo75esc ... argument does not escape$"
}
func foo75aesc(z *int) { // ERROR "foo75aesc z does not escape$"
@@ -640,30 +640,28 @@
sink = myprint1(z, 1, 2, 3) // ERROR "... argument escapes to heap$" "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "myprint1\(z, 1, 2, 3\) escapes to heap$"
}
-// BAD: z does not escape here
-func foo76(z *int) { // ERROR "leaking param: z$"
- myprint(nil, z) // ERROR "foo76 ... argument does not escape$" "z escapes to heap$"
+func foo76(z *int) { // ERROR "z does not escape"
+ myprint(nil, z) // ERROR "foo76 ... argument does not escape$" "z does not escape"
}
-// BAD: z does not escape here
-func foo76a(z *int) { // ERROR "leaking param: z$"
- myprint1(nil, z) // ERROR "foo76a ... argument does not escape$" "z escapes to heap$"
+func foo76a(z *int) { // ERROR "z does not escape"
+ myprint1(nil, z) // ERROR "foo76a ... argument does not escape$" "z does not escape"
}
func foo76b() {
- myprint(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76b ... argument does not escape$"
+ myprint(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76b ... argument does not escape$"
}
func foo76c() {
- myprint1(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76c ... argument does not escape$"
+ myprint1(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76c ... argument does not escape$"
}
func foo76d() {
- defer myprint(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76d ... argument does not escape$"
+ defer myprint(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76d ... argument does not escape$"
}
func foo76e() {
- defer myprint1(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76e ... argument does not escape$"
+ defer myprint1(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76e ... argument does not escape$"
}
func foo76f() {
@@ -697,13 +695,11 @@
}
func dotdotdot() {
- // BAD: i should not escape here
- i := 0 // ERROR "moved to heap: i$"
- myprint(nil, &i) // ERROR "&i escapes to heap$" "dotdotdot ... argument does not escape$"
+ i := 0
+ myprint(nil, &i) // ERROR "&i does not escape" "dotdotdot ... argument does not escape$"
- // BAD: j should not escape here
- j := 0 // ERROR "moved to heap: j$"
- myprint1(nil, &j) // ERROR "&j escapes to heap$" "dotdotdot ... argument does not escape$"
+ j := 0
+ myprint1(nil, &j) // ERROR "&j does not escape" "dotdotdot ... argument does not escape$"
}
func foo78(z int) *int { // ERROR "moved to heap: z$"
@@ -1208,7 +1204,7 @@
// loopdepth 1
var i int // ERROR "moved to heap: i$"
func() { // ERROR "foo126 func literal does not escape$"
- px = &i // ERROR "&i escapes to heap$"
+ px = &i // ERROR "&i escapes to heap$" "leaking closure reference i"
}()
}
_ = px
diff --git a/test/escape2n.go b/test/escape2n.go
index c328773..74f6f8d 100644
--- a/test/escape2n.go
+++ b/test/escape2n.go
@@ -1,6 +1,6 @@
// errorcheck -0 -N -m -l
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
@@ -620,15 +620,15 @@
}
func foo75(z *int) { // ERROR "foo75 z does not escape$"
- myprint(z, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo75 ... argument does not escape$"
+ myprint(z, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo75 ... argument does not escape$"
}
func foo75a(z *int) { // ERROR "foo75a z does not escape$"
- myprint1(z, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo75a ... argument does not escape$"
+ myprint1(z, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo75a ... argument does not escape$"
}
func foo75esc(z *int) { // ERROR "leaking param: z$"
- gxx = myprint(z, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo75esc ... argument does not escape$"
+ gxx = myprint(z, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo75esc ... argument does not escape$"
}
func foo75aesc(z *int) { // ERROR "foo75aesc z does not escape$"
@@ -640,30 +640,28 @@
sink = myprint1(z, 1, 2, 3) // ERROR "... argument escapes to heap$" "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "myprint1\(z, 1, 2, 3\) escapes to heap$"
}
-// BAD: z does not escape here
-func foo76(z *int) { // ERROR "leaking param: z$"
- myprint(nil, z) // ERROR "foo76 ... argument does not escape$" "z escapes to heap$"
+func foo76(z *int) { // ERROR "z does not escape"
+ myprint(nil, z) // ERROR "foo76 ... argument does not escape$" "z does not escape"
}
-// BAD: z does not escape here
-func foo76a(z *int) { // ERROR "leaking param: z$"
- myprint1(nil, z) // ERROR "foo76a ... argument does not escape$" "z escapes to heap$"
+func foo76a(z *int) { // ERROR "z does not escape"
+ myprint1(nil, z) // ERROR "foo76a ... argument does not escape$" "z does not escape"
}
func foo76b() {
- myprint(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76b ... argument does not escape$"
+ myprint(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76b ... argument does not escape$"
}
func foo76c() {
- myprint1(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76c ... argument does not escape$"
+ myprint1(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76c ... argument does not escape$"
}
func foo76d() {
- defer myprint(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76d ... argument does not escape$"
+ defer myprint(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76d ... argument does not escape$"
}
func foo76e() {
- defer myprint1(nil, 1, 2, 3) // ERROR "1 escapes to heap$" "2 escapes to heap$" "3 escapes to heap$" "foo76e ... argument does not escape$"
+ defer myprint1(nil, 1, 2, 3) // ERROR "1 does not escape" "2 does not escape" "3 does not escape" "foo76e ... argument does not escape$"
}
func foo76f() {
@@ -697,13 +695,11 @@
}
func dotdotdot() {
- // BAD: i should not escape here
- i := 0 // ERROR "moved to heap: i$"
- myprint(nil, &i) // ERROR "&i escapes to heap$" "dotdotdot ... argument does not escape$"
+ i := 0
+ myprint(nil, &i) // ERROR "&i does not escape" "dotdotdot ... argument does not escape$"
- // BAD: j should not escape here
- j := 0 // ERROR "moved to heap: j$"
- myprint1(nil, &j) // ERROR "&j escapes to heap$" "dotdotdot ... argument does not escape$"
+ j := 0
+ myprint1(nil, &j) // ERROR "&j does not escape" "dotdotdot ... argument does not escape$"
}
func foo78(z int) *int { // ERROR "moved to heap: z$"
@@ -1208,7 +1204,7 @@
// loopdepth 1
var i int // ERROR "moved to heap: i$"
func() { // ERROR "foo126 func literal does not escape$"
- px = &i // ERROR "&i escapes to heap$"
+ px = &i // ERROR "&i escapes to heap$" "leaking closure reference i"
}()
}
_ = px
diff --git a/test/escape3.go b/test/escape3.go
index 4c19891..f1131a2 100644
--- a/test/escape3.go
+++ b/test/escape3.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/escape4.go b/test/escape4.go
index 248f8a9..69a54ac 100644
--- a/test/escape4.go
+++ b/test/escape4.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/escape5.go b/test/escape5.go
index 6a138ea..c4bf17b 100644
--- a/test/escape5.go
+++ b/test/escape5.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/escape_array.go b/test/escape_array.go
index 5da7771..0204c69 100644
--- a/test/escape_array.go
+++ b/test/escape_array.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_because.go b/test/escape_because.go
new file mode 100644
index 0000000..f0bbd0b
--- /dev/null
+++ b/test/escape_because.go
@@ -0,0 +1,177 @@
+// errorcheck -0 -m -m -l
+
+// Copyright 2015 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.
+
+// Note the doubled -m; this tests the "because" explanations for escapes,
+// and is likely to be annoyingly fragile under compiler change.
+// As long as the explanations look reasonably sane, meaning eyeball verify output of
+// go build -gcflags '-l -m -m' escape_because.go
+// and investigate changes, feel free to update with
+// go run run.go -update_errors -- escape_because.go
+
+package main
+
+func main() {
+}
+
+var sink interface{}
+
+type pair struct {
+ x, y *int
+}
+
+type Pairy interface {
+ EqualParts() bool
+}
+
+func (p *pair) EqualParts() bool { // ERROR "\(\*pair\).EqualParts p does not escape$"
+ return p != nil && (p.x == p.y || *p.x == *p.y)
+}
+
+func f1(p *int) { // ERROR "from \[3\]\*int literal \(array literal element\) at escape_because.go:34$" "from a \(assigned\) at escape_because.go:34$" "from a \(interface-converted\) at escape_because.go:35$" "from sink \(assigned to top level variable\) at escape_because.go:19$" "leaking param: p$"
+ a := [3]*int{p, nil, nil}
+ sink = a // ERROR "a escapes to heap$" "from sink \(assigned to top level variable\) at escape_because.go:19$"
+
+}
+
+func f2(q *int) { // ERROR "from &u \(address-of\) at escape_because.go:43$" "from &u \(interface-converted\) at escape_because.go:43$" "from pair literal \(struct literal element\) at escape_because.go:41$" "from s \(assigned\) at escape_because.go:40$" "from sink \(assigned to top level variable\) at escape_because.go:19$" "from t \(assigned\) at escape_because.go:41$" "from u \(assigned\) at escape_because.go:42$" "leaking param: q$"
+ s := q
+ t := pair{s, nil}
+ u := t // ERROR "moved to heap: u$"
+ sink = &u // ERROR "&u escapes to heap$" "from &u \(interface-converted\) at escape_because.go:43$" "from sink \(assigned to top level variable\) at escape_because.go:19$"
+}
+
+func f3(r *int) interface{} { // ERROR "from \[\]\*int literal \(slice-literal-element\) at escape_because.go:47$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:46$" "leaking param: r to result ~r1 level=-1$"
+ c := []*int{r} // ERROR "\[\]\*int literal escapes to heap$" "from c \(assigned\) at escape_because.go:47$" "from c \(interface-converted\) at escape_because.go:48$" "from ~r1 \(return\) at escape_because.go:46$"
+ return c // "return" // ERROR "c escapes to heap$" "from ~r1 \(return\) at escape_because.go:46$"
+}
+
+func f4(a *int, s []*int) int { // ERROR "from \*s \(indirection\) at escape_because.go:51$" "from append\(s, a\) \(appended to slice\) at escape_because.go:52$" "from append\(s, a\) \(appendee slice\) at escape_because.go:52$" "leaking param content: s$" "leaking param: a$"
+ s = append(s, a)
+ return *(s[0])
+}
+
+func f5(s1, s2 []*int) int { // ERROR "from \*s1 \(indirection\) at escape_because.go:56$" "from \*s2 \(indirection\) at escape_because.go:56$" "from append\(s1, s2...\) \(appended slice...\) at escape_because.go:57$" "from append\(s1, s2...\) \(appendee slice\) at escape_because.go:57$" "leaking param content: s1$" "leaking param content: s2$"
+ s1 = append(s1, s2...)
+ return *(s1[0])
+}
+
+func f6(x, y *int) bool { // ERROR "f6 x does not escape$" "f6 y does not escape$"
+ p := pair{x, y}
+ var P Pairy = &p // ERROR "f6 &p does not escape$"
+ pp := P.(*pair)
+ return pp.EqualParts()
+}
+
+func f7(x map[int]*int, y int) *int { // ERROR "f7 x does not escape$"
+ z, ok := x[y]
+ if !ok {
+ return nil
+ }
+ return z
+}
+
+func f8(x int, y *int) *int { // ERROR "from ~r2 \(return\) at escape_because.go:76$" "from ~r2 \(returned from recursive function\) at escape_because.go:76$" "leaking param: y$" "moved to heap: x$"
+ if x <= 0 {
+ return y
+ }
+ x--
+ return f8(*y, &x) // ERROR "&x escapes to heap$" "from y \(arg to recursive call\) at escape_because.go:76$" "from ~r2 \(return\) at escape_because.go:76$" "from ~r2 \(returned from recursive function\) at escape_because.go:76$"
+}
+
+func f9(x int, y ...*int) *int { // ERROR "from y\[0\] \(dot of pointer\) at escape_because.go:86$" "from ~r2 \(return\) at escape_because.go:84$" "from ~r2 \(returned from recursive function\) at escape_because.go:84$" "leaking param content: y$" "leaking param: y to result ~r2 level=1$" "moved to heap: x$"
+ if x <= 0 {
+ return y[0]
+ }
+ x--
+ return f9(*y[0], &x) // ERROR "&x escapes to heap$" "f9 ... argument does not escape$" "from ... argument \(... arg to recursive call\) at escape_because.go:89$"
+}
+
+func f10(x map[*int]*int, y, z *int) *int { // ERROR "f10 x does not escape$" "from x\[y\] \(key of map put\) at escape_because.go:93$" "from x\[y\] \(value of map put\) at escape_because.go:93$" "leaking param: y$" "leaking param: z$"
+ x[y] = z
+ return z
+}
+
+func f11(x map[*int]*int, y, z *int) map[*int]*int { // ERROR "f11 x does not escape$" "from map\[\*int\]\*int literal \(map literal key\) at escape_because.go:98$" "from map\[\*int\]\*int literal \(map literal value\) at escape_because.go:98$" "leaking param: y$" "leaking param: z$"
+ return map[*int]*int{y: z} // ERROR "from ~r3 \(return\) at escape_because.go:97$" "map\[\*int\]\*int literal escapes to heap$"
+}
+
+// The list below is all of the why-escapes messages seen building the escape analysis tests.
+/*
+ for i in escape*go ; do echo compile $i; go build -gcflags '-l -m -m' $i >& `basename $i .go`.log ; done
+ grep 'from .* at ' escape*.log | sed -e 's/^.*(\([^()]*\))[^()]*$/\1/' | sort -u
+*/
+// sed RE above assumes that (reason) is the last parenthesized phrase in the line,
+// and that none of the reasons contains any parentheses
+
+/*
+... arg to recursive call
+address-of
+appended slice...
+appended to slice
+appendee slice
+arg to ...
+arg to recursive call
+array literal element
+array-element-equals
+assign-pair
+assign-pair-dot-type
+assign-pair-func-call
+assigned
+assigned to top level variable
+call part
+captured by a closure
+closure-var
+converted
+copied slice
+defer func
+defer func ...
+defer func arg
+dot
+dot of pointer
+dot-equals
+fixed-array-index-of
+go func
+go func ...
+go func arg
+indirection
+interface-converted
+key of map put
+map literal key
+map literal value
+parameter to indirect call
+passed to function[content escapes]
+passed to function[unknown]
+passed-to-and-returned-from-function
+pointer literal
+range
+range-deref
+receiver in indirect call
+return
+returned from recursive function
+send
+slice
+slice-element-equals
+slice-literal-element
+star-dot-equals
+star-equals
+struct literal element
+switch case
+too large for stack
+value of map put
+*/
+
+// Expected, but not yet seen (they may be unreachable):
+
+/*
+append-first-arg
+assign-pair-mapr
+assign-pair-receive
+call receiver
+map index
+panic
+pointer literal [assign]
+slice literal element
+*/
diff --git a/test/escape_calls.go b/test/escape_calls.go
index 8c9a6da..20cb643 100644
--- a/test/escape_calls.go
+++ b/test/escape_calls.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_closure.go b/test/escape_closure.go
index 4cdb06e..e9cf776 100644
--- a/test/escape_closure.go
+++ b/test/escape_closure.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
@@ -145,3 +145,29 @@
// BAD: p should not escape here
}(&p) // ERROR "&p escapes to heap" "\(func literal\)\(&p\) escapes to heap"
}
+
+func ClosureLeak1(s string) string { // ERROR "ClosureLeak1 s does not escape"
+ t := s + "YYYY" // ERROR "escapes to heap"
+ return ClosureLeak1a(t) // ERROR "ClosureLeak1 ... argument does not escape"
+}
+
+// See #14409 -- returning part of captured var leaks it.
+func ClosureLeak1a(a ...string) string { // ERROR "leaking param: a to result ~r1 level=1"
+ return func() string { // ERROR "ClosureLeak1a func literal does not escape"
+ return a[0]
+ }()
+}
+
+func ClosureLeak2(s string) string { // ERROR "ClosureLeak2 s does not escape"
+ t := s + "YYYY" // ERROR "escapes to heap"
+ c := ClosureLeak2a(t) // ERROR "ClosureLeak2 ... argument does not escape"
+ return c
+}
+func ClosureLeak2a(a ...string) string { // ERROR "leaking param: a to result ~r1 level=1"
+ return ClosureLeak2b(func() string { // ERROR "ClosureLeak2a func literal does not escape"
+ return a[0]
+ })
+}
+func ClosureLeak2b(f func() string) string { // ERROR "leaking param: f to result ~r1 level=1"
+ return f()
+}
diff --git a/test/escape_field.go b/test/escape_field.go
index 16d1e74..e8835ae 100644
--- a/test/escape_field.go
+++ b/test/escape_field.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_iface.go b/test/escape_iface.go
index 2b1144a..50a5132 100644
--- a/test/escape_iface.go
+++ b/test/escape_iface.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
@@ -225,3 +225,23 @@
T1: *(x.(*T1)), // ERROR "&T2 literal escapes to heap"
}
}
+
+func dotTypeEscape2() { // #13805
+ {
+ i := 0
+ var v int
+ var x interface{} = i // ERROR "i does not escape"
+ *(&v) = x.(int) // ERROR "&v does not escape"
+ }
+ {
+ i := 0
+ var x interface{} = i // ERROR "i does not escape"
+ sink = x.(int) // ERROR "x.\(int\) escapes to heap"
+
+ }
+ {
+ i := 0 // ERROR "moved to heap: i"
+ var x interface{} = &i // ERROR "&i escapes to heap"
+ sink = x.(*int) // ERROR "x.\(\*int\) escapes to heap"
+ }
+}
diff --git a/test/escape_indir.go b/test/escape_indir.go
index fe03c3f..aac4e67 100644
--- a/test/escape_indir.go
+++ b/test/escape_indir.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_level.go b/test/escape_level.go
index 867c81a..490f615 100644
--- a/test/escape_level.go
+++ b/test/escape_level.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_map.go b/test/escape_map.go
index 868c456..99cbd48 100644
--- a/test/escape_map.go
+++ b/test/escape_map.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_param.go b/test/escape_param.go
index cfbcd51..2c43b96 100644
--- a/test/escape_param.go
+++ b/test/escape_param.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_slice.go b/test/escape_slice.go
index 0b65997..ffd7cdb 100644
--- a/test/escape_slice.go
+++ b/test/escape_slice.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_struct_param1.go b/test/escape_struct_param1.go
index e30e327..076fbc8 100644
--- a/test/escape_struct_param1.go
+++ b/test/escape_struct_param1.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_struct_param2.go b/test/escape_struct_param2.go
index c10c336..d5305d4 100644
--- a/test/escape_struct_param2.go
+++ b/test/escape_struct_param2.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/escape_struct_return.go b/test/escape_struct_return.go
index b423ebd..565f08e 100644
--- a/test/escape_struct_return.go
+++ b/test/escape_struct_return.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m -l
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/finprofiled.go b/test/finprofiled.go
new file mode 100644
index 0000000..0eb801a
--- /dev/null
+++ b/test/finprofiled.go
@@ -0,0 +1,74 @@
+// run
+
+// Copyright 2015 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.
+
+// Test that tiny allocations with finalizers are correctly profiled.
+// Previously profile special records could have been processed prematurely
+// (while the object is still live).
+
+package main
+
+import (
+ "runtime"
+ "time"
+ "unsafe"
+)
+
+func main() {
+ runtime.MemProfileRate = 1
+ // Allocate 1M 4-byte objects and set a finalizer for every third object.
+ // Assuming that tiny block size is 16, some objects get finalizers setup
+ // only for middle bytes. The finalizer resurrects that object.
+ // As the result, all allocated memory must stay alive.
+ const (
+ N = 1 << 20
+ tinyBlockSize = 16 // runtime._TinySize
+ )
+ hold := make([]*int32, 0, N)
+ for i := 0; i < N; i++ {
+ x := new(int32)
+ if i%3 == 0 {
+ runtime.SetFinalizer(x, func(p *int32) {
+ hold = append(hold, p)
+ })
+ }
+ }
+ // Finalize as much as possible.
+ // Note: the sleep only increases probility of bug detection,
+ // it cannot lead to false failure.
+ for i := 0; i < 5; i++ {
+ runtime.GC()
+ time.Sleep(10 * time.Millisecond)
+ }
+ // Read memory profile.
+ var prof []runtime.MemProfileRecord
+ for {
+ if n, ok := runtime.MemProfile(prof, false); ok {
+ prof = prof[:n]
+ break
+ } else {
+ prof = make([]runtime.MemProfileRecord, n+10)
+ }
+ }
+ // See how much memory in tiny objects is profiled.
+ var totalBytes int64
+ for _, p := range prof {
+ bytes := p.AllocBytes - p.FreeBytes
+ nobj := p.AllocObjects - p.FreeObjects
+ size := bytes / nobj
+ if size == tinyBlockSize {
+ totalBytes += bytes
+ }
+ }
+ // 2*tinyBlockSize slack is for any boundary effects.
+ if want := N*int64(unsafe.Sizeof(int32(0))) - 2*tinyBlockSize; totalBytes < want {
+ println("got", totalBytes, "want >=", want)
+ panic("some of the tiny objects are not profiled")
+ }
+ // Just to keep hold alive.
+ if len(hold) != 0 && hold[0] == nil {
+ panic("bad")
+ }
+}
diff --git a/test/fixedbugs/bug083.dir/bug0.go b/test/fixedbugs/bug083.dir/bug0.go
index e312256..2f59d81 100644
--- a/test/fixedbugs/bug083.dir/bug0.go
+++ b/test/fixedbugs/bug083.dir/bug0.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug083.dir/bug1.go b/test/fixedbugs/bug083.dir/bug1.go
index 486fe76..ea5bcfe 100644
--- a/test/fixedbugs/bug083.dir/bug1.go
+++ b/test/fixedbugs/bug083.dir/bug1.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug088.dir/bug0.go b/test/fixedbugs/bug088.dir/bug0.go
index af9d991..7a6e347 100644
--- a/test/fixedbugs/bug088.dir/bug0.go
+++ b/test/fixedbugs/bug088.dir/bug0.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug088.dir/bug1.go b/test/fixedbugs/bug088.dir/bug1.go
index cadf0e6..2568e37 100644
--- a/test/fixedbugs/bug088.dir/bug1.go
+++ b/test/fixedbugs/bug088.dir/bug1.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug106.dir/bug0.go b/test/fixedbugs/bug106.dir/bug0.go
index d9c26a0..7494c58 100644
--- a/test/fixedbugs/bug106.dir/bug0.go
+++ b/test/fixedbugs/bug106.dir/bug0.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug106.dir/bug1.go b/test/fixedbugs/bug106.dir/bug1.go
index 0f1d20e..eff0d36 100644
--- a/test/fixedbugs/bug106.dir/bug1.go
+++ b/test/fixedbugs/bug106.dir/bug1.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug108.go b/test/fixedbugs/bug108.go
index 9f2a27e..cfec4c9 100644
--- a/test/fixedbugs/bug108.go
+++ b/test/fixedbugs/bug108.go
@@ -6,6 +6,6 @@
package main
func f() {
- v := 1 << 1025; // ERROR "overflow|stupid shift"
+ v := 1 << 1025; // ERROR "overflow|shift count too large"
_ = v
}
diff --git a/test/fixedbugs/bug133.dir/bug0.go b/test/fixedbugs/bug133.dir/bug0.go
index 48cd104..19a2bfb 100644
--- a/test/fixedbugs/bug133.dir/bug0.go
+++ b/test/fixedbugs/bug133.dir/bug0.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug133.dir/bug1.go b/test/fixedbugs/bug133.dir/bug1.go
index 7562147..dd59b2f 100644
--- a/test/fixedbugs/bug133.dir/bug1.go
+++ b/test/fixedbugs/bug133.dir/bug1.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug133.dir/bug2.go b/test/fixedbugs/bug133.dir/bug2.go
index e531001..b6184c2 100644
--- a/test/fixedbugs/bug133.dir/bug2.go
+++ b/test/fixedbugs/bug133.dir/bug2.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug13343.go b/test/fixedbugs/bug13343.go
new file mode 100644
index 0000000..5dc736d
--- /dev/null
+++ b/test/fixedbugs/bug13343.go
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2015 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 main
+
+var (
+ a, b = f() // ERROR "initialization loop|depends upon itself"
+ c = b
+)
+
+func f() (int, int) {
+ return c, c
+}
+
+func main() {}
diff --git a/test/fixedbugs/bug1515.go b/test/fixedbugs/bug1515.go
index a4baccd..5fef5ad 100644
--- a/test/fixedbugs/bug1515.go
+++ b/test/fixedbugs/bug1515.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug160.dir/x.go b/test/fixedbugs/bug160.dir/x.go
index bd52c6c..2673552 100644
--- a/test/fixedbugs/bug160.dir/x.go
+++ b/test/fixedbugs/bug160.dir/x.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug160.dir/y.go b/test/fixedbugs/bug160.dir/y.go
index 27e2f35..428808d 100644
--- a/test/fixedbugs/bug160.dir/y.go
+++ b/test/fixedbugs/bug160.dir/y.go
@@ -1,4 +1,4 @@
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug203.go b/test/fixedbugs/bug203.go
index 2fb084b..68647ec 100644
--- a/test/fixedbugs/bug203.go
+++ b/test/fixedbugs/bug203.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug227.go b/test/fixedbugs/bug227.go
index ea8d02d..afbdd97 100644
--- a/test/fixedbugs/bug227.go
+++ b/test/fixedbugs/bug227.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug228.go b/test/fixedbugs/bug228.go
index 3fccd17..f7ac670 100644
--- a/test/fixedbugs/bug228.go
+++ b/test/fixedbugs/bug228.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug229.go b/test/fixedbugs/bug229.go
index 1977688..4baf65e 100644
--- a/test/fixedbugs/bug229.go
+++ b/test/fixedbugs/bug229.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
@@ -14,7 +14,7 @@
// make sure error mentions that
// name is unexported, not just "name not found".
- t.name = nil // ERROR "unexported"
+ t.common.name = nil // ERROR "unexported"
println(testing.anyLowercaseName("asdf")) // ERROR "unexported" "undefined: testing.anyLowercaseName"
}
diff --git a/test/fixedbugs/bug230.go b/test/fixedbugs/bug230.go
index 210acc4..e5eead5 100644
--- a/test/fixedbugs/bug230.go
+++ b/test/fixedbugs/bug230.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug231.go b/test/fixedbugs/bug231.go
index a9d409b..f64ddc3 100644
--- a/test/fixedbugs/bug231.go
+++ b/test/fixedbugs/bug231.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug232.go b/test/fixedbugs/bug232.go
index d18727e..10b0c52 100644
--- a/test/fixedbugs/bug232.go
+++ b/test/fixedbugs/bug232.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug233.go b/test/fixedbugs/bug233.go
index 63f8ee2..d4e1e07 100644
--- a/test/fixedbugs/bug233.go
+++ b/test/fixedbugs/bug233.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug234.go b/test/fixedbugs/bug234.go
index 9f503f0..0d37ce2 100644
--- a/test/fixedbugs/bug234.go
+++ b/test/fixedbugs/bug234.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug235.go b/test/fixedbugs/bug235.go
index d12d9e7..a33092b 100644
--- a/test/fixedbugs/bug235.go
+++ b/test/fixedbugs/bug235.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug236.go b/test/fixedbugs/bug236.go
index 6c24556..de7e8e3 100644
--- a/test/fixedbugs/bug236.go
+++ b/test/fixedbugs/bug236.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug237.go b/test/fixedbugs/bug237.go
index 58996ca..75d6132 100644
--- a/test/fixedbugs/bug237.go
+++ b/test/fixedbugs/bug237.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug243.go b/test/fixedbugs/bug243.go
index 4870c36..5b6bb75 100644
--- a/test/fixedbugs/bug243.go
+++ b/test/fixedbugs/bug243.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug245.go b/test/fixedbugs/bug245.go
index c607a6d..adf62f9 100644
--- a/test/fixedbugs/bug245.go
+++ b/test/fixedbugs/bug245.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug247.go b/test/fixedbugs/bug247.go
index b6851e1..6550bd8 100644
--- a/test/fixedbugs/bug247.go
+++ b/test/fixedbugs/bug247.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug249.go b/test/fixedbugs/bug249.go
index dc92245..ec9699a 100644
--- a/test/fixedbugs/bug249.go
+++ b/test/fixedbugs/bug249.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/fixedbugs/bug250.go b/test/fixedbugs/bug250.go
index 5140f3e..9fb34c3 100644
--- a/test/fixedbugs/bug250.go
+++ b/test/fixedbugs/bug250.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug251.go b/test/fixedbugs/bug251.go
index 43d9d52..f061723 100644
--- a/test/fixedbugs/bug251.go
+++ b/test/fixedbugs/bug251.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug252.go b/test/fixedbugs/bug252.go
index 6f007fb..f678925 100644
--- a/test/fixedbugs/bug252.go
+++ b/test/fixedbugs/bug252.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug253.go b/test/fixedbugs/bug253.go
index f6ab712..933f3f1 100644
--- a/test/fixedbugs/bug253.go
+++ b/test/fixedbugs/bug253.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug254.go b/test/fixedbugs/bug254.go
index 9b1c819..3902cd5 100644
--- a/test/fixedbugs/bug254.go
+++ b/test/fixedbugs/bug254.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug255.go b/test/fixedbugs/bug255.go
index 65ed1b8..cc7d92f 100644
--- a/test/fixedbugs/bug255.go
+++ b/test/fixedbugs/bug255.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug256.go b/test/fixedbugs/bug256.go
index 0498a40..705a032 100644
--- a/test/fixedbugs/bug256.go
+++ b/test/fixedbugs/bug256.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug257.go b/test/fixedbugs/bug257.go
index 003f3ff..b05c37a 100644
--- a/test/fixedbugs/bug257.go
+++ b/test/fixedbugs/bug257.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug258.go b/test/fixedbugs/bug258.go
index d362e5a..075da87 100644
--- a/test/fixedbugs/bug258.go
+++ b/test/fixedbugs/bug258.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug259.go b/test/fixedbugs/bug259.go
index e4dcaeb..857b442 100644
--- a/test/fixedbugs/bug259.go
+++ b/test/fixedbugs/bug259.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug261.go b/test/fixedbugs/bug261.go
index f7879b0..abe6431 100644
--- a/test/fixedbugs/bug261.go
+++ b/test/fixedbugs/bug261.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug266.go b/test/fixedbugs/bug266.go
index d4da891..5d2334c 100644
--- a/test/fixedbugs/bug266.go
+++ b/test/fixedbugs/bug266.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug269.go b/test/fixedbugs/bug269.go
index 60ee7ee..ec0dbc6 100644
--- a/test/fixedbugs/bug269.go
+++ b/test/fixedbugs/bug269.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug271.go b/test/fixedbugs/bug271.go
index 30d9bb1..a6abbfe 100644
--- a/test/fixedbugs/bug271.go
+++ b/test/fixedbugs/bug271.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug272.go b/test/fixedbugs/bug272.go
index f943d68..6b8862f 100644
--- a/test/fixedbugs/bug272.go
+++ b/test/fixedbugs/bug272.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug273.go b/test/fixedbugs/bug273.go
index b4e3f65..b6258d5 100644
--- a/test/fixedbugs/bug273.go
+++ b/test/fixedbugs/bug273.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug274.go b/test/fixedbugs/bug274.go
index e57d147..e93f30e 100644
--- a/test/fixedbugs/bug274.go
+++ b/test/fixedbugs/bug274.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug275.go b/test/fixedbugs/bug275.go
index f5f6b14..d3be754 100644
--- a/test/fixedbugs/bug275.go
+++ b/test/fixedbugs/bug275.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug278.go b/test/fixedbugs/bug278.go
index 68a3d81..4817ebf 100644
--- a/test/fixedbugs/bug278.go
+++ b/test/fixedbugs/bug278.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug279.go b/test/fixedbugs/bug279.go
index 726ba60..3b1df3b 100644
--- a/test/fixedbugs/bug279.go
+++ b/test/fixedbugs/bug279.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug280.go b/test/fixedbugs/bug280.go
index 3925b9a..afec57f 100644
--- a/test/fixedbugs/bug280.go
+++ b/test/fixedbugs/bug280.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug281.go b/test/fixedbugs/bug281.go
index 92c8d86..c65530f 100644
--- a/test/fixedbugs/bug281.go
+++ b/test/fixedbugs/bug281.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug282.dir/p1.go b/test/fixedbugs/bug282.dir/p1.go
index b562755..0f7422c 100644
--- a/test/fixedbugs/bug282.dir/p1.go
+++ b/test/fixedbugs/bug282.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug282.dir/p2.go b/test/fixedbugs/bug282.dir/p2.go
index 3f8bd9d..f614507 100644
--- a/test/fixedbugs/bug282.dir/p2.go
+++ b/test/fixedbugs/bug282.dir/p2.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug283.go b/test/fixedbugs/bug283.go
index 1f7f6e0..ef1953b 100644
--- a/test/fixedbugs/bug283.go
+++ b/test/fixedbugs/bug283.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug285.go b/test/fixedbugs/bug285.go
index e0b3766..0632ab4 100644
--- a/test/fixedbugs/bug285.go
+++ b/test/fixedbugs/bug285.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug286.go b/test/fixedbugs/bug286.go
index 44f0515..b1271f4 100644
--- a/test/fixedbugs/bug286.go
+++ b/test/fixedbugs/bug286.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug287.go b/test/fixedbugs/bug287.go
index 2ed81c5..94582a8 100644
--- a/test/fixedbugs/bug287.go
+++ b/test/fixedbugs/bug287.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug288.go b/test/fixedbugs/bug288.go
index d2461e6..0a53d32 100644
--- a/test/fixedbugs/bug288.go
+++ b/test/fixedbugs/bug288.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug289.go b/test/fixedbugs/bug289.go
index 3c6b687..5a30979 100644
--- a/test/fixedbugs/bug289.go
+++ b/test/fixedbugs/bug289.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug290.go b/test/fixedbugs/bug290.go
index 46ebc1f..4eee285 100644
--- a/test/fixedbugs/bug290.go
+++ b/test/fixedbugs/bug290.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug291.go b/test/fixedbugs/bug291.go
index d627a9d..ac84a7e 100644
--- a/test/fixedbugs/bug291.go
+++ b/test/fixedbugs/bug291.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug292.go b/test/fixedbugs/bug292.go
index 0c24912..1130a28 100644
--- a/test/fixedbugs/bug292.go
+++ b/test/fixedbugs/bug292.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug293.go b/test/fixedbugs/bug293.go
index c985305..ae7cc1f 100644
--- a/test/fixedbugs/bug293.go
+++ b/test/fixedbugs/bug293.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug294.go b/test/fixedbugs/bug294.go
index ec41fe8..b35b771 100644
--- a/test/fixedbugs/bug294.go
+++ b/test/fixedbugs/bug294.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug295.go b/test/fixedbugs/bug295.go
index 63a12a3..d1c961c 100644
--- a/test/fixedbugs/bug295.go
+++ b/test/fixedbugs/bug295.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug296.go b/test/fixedbugs/bug296.go
index a7c4e0c..2ef4e66 100644
--- a/test/fixedbugs/bug296.go
+++ b/test/fixedbugs/bug296.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug297.go b/test/fixedbugs/bug297.go
index ee2ff92..852d208 100644
--- a/test/fixedbugs/bug297.go
+++ b/test/fixedbugs/bug297.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug298.go b/test/fixedbugs/bug298.go
index bd362ac..0aed032 100644
--- a/test/fixedbugs/bug298.go
+++ b/test/fixedbugs/bug298.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug299.go b/test/fixedbugs/bug299.go
index 1067fd1..cf11bcc 100644
--- a/test/fixedbugs/bug299.go
+++ b/test/fixedbugs/bug299.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug300.go b/test/fixedbugs/bug300.go
index 1ef43a0..1695a96 100644
--- a/test/fixedbugs/bug300.go
+++ b/test/fixedbugs/bug300.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug301.go b/test/fixedbugs/bug301.go
index fc52503..2be62b8 100644
--- a/test/fixedbugs/bug301.go
+++ b/test/fixedbugs/bug301.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug302.dir/main.go b/test/fixedbugs/bug302.dir/main.go
index 281f908..52c054f 100644
--- a/test/fixedbugs/bug302.dir/main.go
+++ b/test/fixedbugs/bug302.dir/main.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug302.dir/p.go b/test/fixedbugs/bug302.dir/p.go
index 7c54b90..0be521b 100644
--- a/test/fixedbugs/bug302.dir/p.go
+++ b/test/fixedbugs/bug302.dir/p.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug302.go b/test/fixedbugs/bug302.go
index 42345a9..e4de25d 100644
--- a/test/fixedbugs/bug302.go
+++ b/test/fixedbugs/bug302.go
@@ -1,7 +1,7 @@
// +build !nacl
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug303.go b/test/fixedbugs/bug303.go
index 94ca07e..aef8b22 100644
--- a/test/fixedbugs/bug303.go
+++ b/test/fixedbugs/bug303.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug304.go b/test/fixedbugs/bug304.go
index ad71b20..4073073 100644
--- a/test/fixedbugs/bug304.go
+++ b/test/fixedbugs/bug304.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug305.go b/test/fixedbugs/bug305.go
index d0a4b24..0c34b1a 100644
--- a/test/fixedbugs/bug305.go
+++ b/test/fixedbugs/bug305.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug306.dir/p1.go b/test/fixedbugs/bug306.dir/p1.go
index bf87ea1..b285518 100644
--- a/test/fixedbugs/bug306.dir/p1.go
+++ b/test/fixedbugs/bug306.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug306.dir/p2.go b/test/fixedbugs/bug306.dir/p2.go
index 3f8bd9d..f614507 100644
--- a/test/fixedbugs/bug306.dir/p2.go
+++ b/test/fixedbugs/bug306.dir/p2.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug308.go b/test/fixedbugs/bug308.go
index 5bea517..a23903c 100644
--- a/test/fixedbugs/bug308.go
+++ b/test/fixedbugs/bug308.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug309.go b/test/fixedbugs/bug309.go
index 948ca5c..d707aa3 100644
--- a/test/fixedbugs/bug309.go
+++ b/test/fixedbugs/bug309.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug311.go b/test/fixedbugs/bug311.go
index edcd975..f5cab44 100644
--- a/test/fixedbugs/bug311.go
+++ b/test/fixedbugs/bug311.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug312.go b/test/fixedbugs/bug312.go
index c7c17e1..af423e5 100644
--- a/test/fixedbugs/bug312.go
+++ b/test/fixedbugs/bug312.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug313.dir/a.go b/test/fixedbugs/bug313.dir/a.go
index cb4ca72..335f84d 100644
--- a/test/fixedbugs/bug313.dir/a.go
+++ b/test/fixedbugs/bug313.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug313.dir/b.go b/test/fixedbugs/bug313.dir/b.go
index 7eda72b..26e6413 100644
--- a/test/fixedbugs/bug313.dir/b.go
+++ b/test/fixedbugs/bug313.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug313.go b/test/fixedbugs/bug313.go
index a7c1d36..f7e0238 100644
--- a/test/fixedbugs/bug313.go
+++ b/test/fixedbugs/bug313.go
@@ -1,6 +1,6 @@
// errorcheckdir
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/fixedbugs/bug317.go b/test/fixedbugs/bug317.go
index 3ff4dc4..4cd9ec2 100644
--- a/test/fixedbugs/bug317.go
+++ b/test/fixedbugs/bug317.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug319.go b/test/fixedbugs/bug319.go
index f8e959a..b93106d 100644
--- a/test/fixedbugs/bug319.go
+++ b/test/fixedbugs/bug319.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug320.go b/test/fixedbugs/bug320.go
index c2dd31b..0406b96 100644
--- a/test/fixedbugs/bug320.go
+++ b/test/fixedbugs/bug320.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug321.go b/test/fixedbugs/bug321.go
index 7d01827..19970af 100644
--- a/test/fixedbugs/bug321.go
+++ b/test/fixedbugs/bug321.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug323.go b/test/fixedbugs/bug323.go
index 9730ae5..3cb8eaa 100644
--- a/test/fixedbugs/bug323.go
+++ b/test/fixedbugs/bug323.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug325.go b/test/fixedbugs/bug325.go
index 6ccd0e3..e6528ae 100644
--- a/test/fixedbugs/bug325.go
+++ b/test/fixedbugs/bug325.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug326.go b/test/fixedbugs/bug326.go
index 57f6471..75d620c 100644
--- a/test/fixedbugs/bug326.go
+++ b/test/fixedbugs/bug326.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug327.go b/test/fixedbugs/bug327.go
index 0598d95..ecb5d22 100644
--- a/test/fixedbugs/bug327.go
+++ b/test/fixedbugs/bug327.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug328.go b/test/fixedbugs/bug328.go
index 73ab46d..180af05 100644
--- a/test/fixedbugs/bug328.go
+++ b/test/fixedbugs/bug328.go
@@ -1,6 +1,6 @@
// cmpout
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug329.go b/test/fixedbugs/bug329.go
index 74fc781..37c93d0 100644
--- a/test/fixedbugs/bug329.go
+++ b/test/fixedbugs/bug329.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug330.go b/test/fixedbugs/bug330.go
index ef6a077..2f33feb 100644
--- a/test/fixedbugs/bug330.go
+++ b/test/fixedbugs/bug330.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug331.go b/test/fixedbugs/bug331.go
index fac0e36..9eb57cd 100644
--- a/test/fixedbugs/bug331.go
+++ b/test/fixedbugs/bug331.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug332.go b/test/fixedbugs/bug332.go
index 702779b..91ae0b2 100644
--- a/test/fixedbugs/bug332.go
+++ b/test/fixedbugs/bug332.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug333.go b/test/fixedbugs/bug333.go
index bb690f0..149843a 100644
--- a/test/fixedbugs/bug333.go
+++ b/test/fixedbugs/bug333.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug334.go b/test/fixedbugs/bug334.go
index bd67169..9558c06 100644
--- a/test/fixedbugs/bug334.go
+++ b/test/fixedbugs/bug334.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug335.dir/a.go b/test/fixedbugs/bug335.dir/a.go
index 256c110..6ecc5c4 100644
--- a/test/fixedbugs/bug335.dir/a.go
+++ b/test/fixedbugs/bug335.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug335.dir/b.go b/test/fixedbugs/bug335.dir/b.go
index 1474470..a7735a8 100644
--- a/test/fixedbugs/bug335.dir/b.go
+++ b/test/fixedbugs/bug335.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug335.go b/test/fixedbugs/bug335.go
index 37c97d7..fda9eb8 100644
--- a/test/fixedbugs/bug335.go
+++ b/test/fixedbugs/bug335.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug336.go b/test/fixedbugs/bug336.go
index fbf2320..fbcd3a5 100644
--- a/test/fixedbugs/bug336.go
+++ b/test/fixedbugs/bug336.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug337.go b/test/fixedbugs/bug337.go
index 38dc665..1a0616f 100644
--- a/test/fixedbugs/bug337.go
+++ b/test/fixedbugs/bug337.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug338.go b/test/fixedbugs/bug338.go
index c2193fc..a4537a4 100644
--- a/test/fixedbugs/bug338.go
+++ b/test/fixedbugs/bug338.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug339.go b/test/fixedbugs/bug339.go
index 59921d4..36be761 100644
--- a/test/fixedbugs/bug339.go
+++ b/test/fixedbugs/bug339.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug340.go b/test/fixedbugs/bug340.go
index d996ab6..118bbac 100644
--- a/test/fixedbugs/bug340.go
+++ b/test/fixedbugs/bug340.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug341.go b/test/fixedbugs/bug341.go
index db1af3e..baab282 100644
--- a/test/fixedbugs/bug341.go
+++ b/test/fixedbugs/bug341.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug342.go b/test/fixedbugs/bug342.go
index ffcb668..f90f6f3 100644
--- a/test/fixedbugs/bug342.go
+++ b/test/fixedbugs/bug342.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug343.go b/test/fixedbugs/bug343.go
index 8220108..fd8bd76 100644
--- a/test/fixedbugs/bug343.go
+++ b/test/fixedbugs/bug343.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug344.go b/test/fixedbugs/bug344.go
index 4a92624..b53abd2 100644
--- a/test/fixedbugs/bug344.go
+++ b/test/fixedbugs/bug344.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug345.dir/io.go b/test/fixedbugs/bug345.dir/io.go
index 1d695c3..ca7a509 100644
--- a/test/fixedbugs/bug345.dir/io.go
+++ b/test/fixedbugs/bug345.dir/io.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug345.dir/main.go b/test/fixedbugs/bug345.dir/main.go
index ddba8da..6e4fdf4 100644
--- a/test/fixedbugs/bug345.dir/main.go
+++ b/test/fixedbugs/bug345.dir/main.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug345.go b/test/fixedbugs/bug345.go
index e291a55..dcf62f0 100644
--- a/test/fixedbugs/bug345.go
+++ b/test/fixedbugs/bug345.go
@@ -1,7 +1,7 @@
// +build !nacl,!plan9,!windows
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug347.go b/test/fixedbugs/bug347.go
index 08edf0f..92afb2e 100644
--- a/test/fixedbugs/bug347.go
+++ b/test/fixedbugs/bug347.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug348.go b/test/fixedbugs/bug348.go
index 54a289a..c7f1346 100644
--- a/test/fixedbugs/bug348.go
+++ b/test/fixedbugs/bug348.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug349.go b/test/fixedbugs/bug349.go
index a3e6bd1..a6e8386 100644
--- a/test/fixedbugs/bug349.go
+++ b/test/fixedbugs/bug349.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug350.go b/test/fixedbugs/bug350.go
index 5ce8996..cdce1cf 100644
--- a/test/fixedbugs/bug350.go
+++ b/test/fixedbugs/bug350.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug351.go b/test/fixedbugs/bug351.go
index 4c5c7c3..8fd63e3 100644
--- a/test/fixedbugs/bug351.go
+++ b/test/fixedbugs/bug351.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug352.go b/test/fixedbugs/bug352.go
index 1ae2d61..464ad7b 100644
--- a/test/fixedbugs/bug352.go
+++ b/test/fixedbugs/bug352.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug353.go b/test/fixedbugs/bug353.go
index 2a532c4..4a65f77 100644
--- a/test/fixedbugs/bug353.go
+++ b/test/fixedbugs/bug353.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug354.go b/test/fixedbugs/bug354.go
index 1245d91..293180f 100644
--- a/test/fixedbugs/bug354.go
+++ b/test/fixedbugs/bug354.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug355.go b/test/fixedbugs/bug355.go
index fcf859b..880353a 100644
--- a/test/fixedbugs/bug355.go
+++ b/test/fixedbugs/bug355.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug356.go b/test/fixedbugs/bug356.go
index 273c5b8..6d93860 100644
--- a/test/fixedbugs/bug356.go
+++ b/test/fixedbugs/bug356.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug357.go b/test/fixedbugs/bug357.go
index ceb2009..e9db50e 100644
--- a/test/fixedbugs/bug357.go
+++ b/test/fixedbugs/bug357.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug358.go b/test/fixedbugs/bug358.go
index 063c2e0..5ca0be1 100644
--- a/test/fixedbugs/bug358.go
+++ b/test/fixedbugs/bug358.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -10,13 +10,14 @@
package main
import (
- "io/ioutil" // GCCGO_ERROR "imported and not used"
+ // avoid imported and not used errors
+ // "io/ioutil"
"net/http"
- "os" // GCCGO_ERROR "imported and not used"
+ // "os"
)
func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
- return func(w http.ResponseWriter, r *http.Request) // ERROR "syntax error|invalid use of type"
+ return func(w http.ResponseWriter, r *http.Request) // ERROR "syntax error|not an expression|invalid use of type"
}
type Page struct {
diff --git a/test/fixedbugs/bug361.go b/test/fixedbugs/bug361.go
index 3e3b7c1..8e28243 100644
--- a/test/fixedbugs/bug361.go
+++ b/test/fixedbugs/bug361.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug362.go b/test/fixedbugs/bug362.go
index b888ccb..771d13d 100644
--- a/test/fixedbugs/bug362.go
+++ b/test/fixedbugs/bug362.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug363.go b/test/fixedbugs/bug363.go
index 615c668..1bd1400 100644
--- a/test/fixedbugs/bug363.go
+++ b/test/fixedbugs/bug363.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug365.go b/test/fixedbugs/bug365.go
index 795323b..985b6de 100644
--- a/test/fixedbugs/bug365.go
+++ b/test/fixedbugs/bug365.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug366.go b/test/fixedbugs/bug366.go
index 33a1a5a..3af5bea 100644
--- a/test/fixedbugs/bug366.go
+++ b/test/fixedbugs/bug366.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug368.go b/test/fixedbugs/bug368.go
index c38cc7f..353ea5a 100644
--- a/test/fixedbugs/bug368.go
+++ b/test/fixedbugs/bug368.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug369.dir/main.go b/test/fixedbugs/bug369.dir/main.go
index 1c9e36b..4812602 100644
--- a/test/fixedbugs/bug369.dir/main.go
+++ b/test/fixedbugs/bug369.dir/main.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug369.dir/pkg.go b/test/fixedbugs/bug369.dir/pkg.go
index cf57041..9964347 100644
--- a/test/fixedbugs/bug369.dir/pkg.go
+++ b/test/fixedbugs/bug369.dir/pkg.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug369.go b/test/fixedbugs/bug369.go
index dd48da8..60162ab 100644
--- a/test/fixedbugs/bug369.go
+++ b/test/fixedbugs/bug369.go
@@ -1,7 +1,7 @@
// +build !nacl,!windows
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug370.go b/test/fixedbugs/bug370.go
index 246bc7c..c5165c5 100644
--- a/test/fixedbugs/bug370.go
+++ b/test/fixedbugs/bug370.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug371.go b/test/fixedbugs/bug371.go
index 86c73bf..3a626e5 100644
--- a/test/fixedbugs/bug371.go
+++ b/test/fixedbugs/bug371.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug372.go b/test/fixedbugs/bug372.go
index 3457856..5fba131 100644
--- a/test/fixedbugs/bug372.go
+++ b/test/fixedbugs/bug372.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug373.go b/test/fixedbugs/bug373.go
index e91f26d..aa0f5d1 100644
--- a/test/fixedbugs/bug373.go
+++ b/test/fixedbugs/bug373.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug374.go b/test/fixedbugs/bug374.go
index 4f0b721..2d604cb 100644
--- a/test/fixedbugs/bug374.go
+++ b/test/fixedbugs/bug374.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug375.go b/test/fixedbugs/bug375.go
index cb159b0..08d5afc 100644
--- a/test/fixedbugs/bug375.go
+++ b/test/fixedbugs/bug375.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug376.go b/test/fixedbugs/bug376.go
index 5fbbc9c..7bef58b 100644
--- a/test/fixedbugs/bug376.go
+++ b/test/fixedbugs/bug376.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug378.go b/test/fixedbugs/bug378.go
index f3346c6..c7b0dac 100644
--- a/test/fixedbugs/bug378.go
+++ b/test/fixedbugs/bug378.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug379.go b/test/fixedbugs/bug379.go
index 14abe46..5638123 100644
--- a/test/fixedbugs/bug379.go
+++ b/test/fixedbugs/bug379.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug380.go b/test/fixedbugs/bug380.go
index 96e1ede..0cb3487 100644
--- a/test/fixedbugs/bug380.go
+++ b/test/fixedbugs/bug380.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug381.go b/test/fixedbugs/bug381.go
index 0253e14..a0a1c8a 100644
--- a/test/fixedbugs/bug381.go
+++ b/test/fixedbugs/bug381.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug382.dir/pkg.go b/test/fixedbugs/bug382.dir/pkg.go
index f8d75d4..92fe4e3 100644
--- a/test/fixedbugs/bug382.dir/pkg.go
+++ b/test/fixedbugs/bug382.dir/pkg.go
@@ -1,4 +1,4 @@
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug383.go b/test/fixedbugs/bug383.go
index 503779c..dc2ecd6 100644
--- a/test/fixedbugs/bug383.go
+++ b/test/fixedbugs/bug383.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug384.go b/test/fixedbugs/bug384.go
index 0233c19..d02352b 100644
--- a/test/fixedbugs/bug384.go
+++ b/test/fixedbugs/bug384.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug385_32.go b/test/fixedbugs/bug385_32.go
index daf2a08..73a1311 100644
--- a/test/fixedbugs/bug385_32.go
+++ b/test/fixedbugs/bug385_32.go
@@ -1,7 +1,7 @@
// +build 386 amd64p32 arm
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug385_64.go b/test/fixedbugs/bug385_64.go
index 6789c0a..0f941ca 100644
--- a/test/fixedbugs/bug385_64.go
+++ b/test/fixedbugs/bug385_64.go
@@ -1,7 +1,7 @@
// +build amd64
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug386.go b/test/fixedbugs/bug386.go
index ec358bd..889c8b0 100644
--- a/test/fixedbugs/bug386.go
+++ b/test/fixedbugs/bug386.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug387.go b/test/fixedbugs/bug387.go
index 59d5ef9..d885445 100644
--- a/test/fixedbugs/bug387.go
+++ b/test/fixedbugs/bug387.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug388.go b/test/fixedbugs/bug388.go
index d41f9ea..af0c9d9 100644
--- a/test/fixedbugs/bug388.go
+++ b/test/fixedbugs/bug388.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -9,7 +9,7 @@
package main
import "runtime"
-func foo(runtime.UintType, i int) { // ERROR "cannot declare name runtime.UintType|named/anonymous mix|undefined identifier"
+func foo(runtime.UintType, i int) { // ERROR "cannot declare name runtime.UintType|mixed named and unnamed|undefined identifier"
println(i, runtime.UintType) // GCCGO_ERROR "undefined identifier"
}
diff --git a/test/fixedbugs/bug389.go b/test/fixedbugs/bug389.go
index 55a02e0..14804c8 100644
--- a/test/fixedbugs/bug389.go
+++ b/test/fixedbugs/bug389.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug391.go b/test/fixedbugs/bug391.go
index 07d129d..9211b1c 100644
--- a/test/fixedbugs/bug391.go
+++ b/test/fixedbugs/bug391.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug392.dir/one.go b/test/fixedbugs/bug392.dir/one.go
index 8242f28..aba8649 100644
--- a/test/fixedbugs/bug392.dir/one.go
+++ b/test/fixedbugs/bug392.dir/one.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug392.dir/pkg2.go b/test/fixedbugs/bug392.dir/pkg2.go
index 8320b2f..2ee41f0 100644
--- a/test/fixedbugs/bug392.dir/pkg2.go
+++ b/test/fixedbugs/bug392.dir/pkg2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug392.dir/pkg3.go b/test/fixedbugs/bug392.dir/pkg3.go
index 402c3b0..1403798 100644
--- a/test/fixedbugs/bug392.dir/pkg3.go
+++ b/test/fixedbugs/bug392.dir/pkg3.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug393.go b/test/fixedbugs/bug393.go
index f8a9c65..61af578 100644
--- a/test/fixedbugs/bug393.go
+++ b/test/fixedbugs/bug393.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug394.go b/test/fixedbugs/bug394.go
index 2d77156..08bac18 100644
--- a/test/fixedbugs/bug394.go
+++ b/test/fixedbugs/bug394.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug396.dir/one.go b/test/fixedbugs/bug396.dir/one.go
index 96a1dd7..66eba63 100644
--- a/test/fixedbugs/bug396.dir/one.go
+++ b/test/fixedbugs/bug396.dir/one.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug396.dir/two.go b/test/fixedbugs/bug396.dir/two.go
index 9b32508..9152bec 100644
--- a/test/fixedbugs/bug396.dir/two.go
+++ b/test/fixedbugs/bug396.dir/two.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug397.go b/test/fixedbugs/bug397.go
index 56cc7cd..6188e3e 100644
--- a/test/fixedbugs/bug397.go
+++ b/test/fixedbugs/bug397.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug398.go b/test/fixedbugs/bug398.go
index 1dd3fa4..81bf33c 100644
--- a/test/fixedbugs/bug398.go
+++ b/test/fixedbugs/bug398.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
@@ -8,17 +8,20 @@
package p
-type I1 interface {
- F() interface{I1}
+type i1 interface {
+ F() interface{i1}
}
-type I2 interface {
- F() interface{I2}
+type i2 interface {
+ F() interface{i2}
}
-var v1 I1
-var v2 I2
+var v1 i1
+var v2 i2
func f() bool {
return v1 == v2
}
+
+// TODO(gri) Change test to use exported interfaces.
+// See issue #15596 for details.
\ No newline at end of file
diff --git a/test/fixedbugs/bug399.go b/test/fixedbugs/bug399.go
index 94852c9..e460d81 100644
--- a/test/fixedbugs/bug399.go
+++ b/test/fixedbugs/bug399.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/fixedbugs/bug401.go b/test/fixedbugs/bug401.go
index 5589b5b..215498e 100644
--- a/test/fixedbugs/bug401.go
+++ b/test/fixedbugs/bug401.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -9,9 +9,8 @@
type T struct{}
+//go:noinline
func (T) cplx() complex128 {
- for false {
- } // avoid inlining
return complex(1, 0)
}
diff --git a/test/fixedbugs/bug402.go b/test/fixedbugs/bug402.go
index db3f3da..f9f554d 100644
--- a/test/fixedbugs/bug402.go
+++ b/test/fixedbugs/bug402.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug403.go b/test/fixedbugs/bug403.go
index ed7b49a..aa3c1ea 100644
--- a/test/fixedbugs/bug403.go
+++ b/test/fixedbugs/bug403.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug404.dir/one.go b/test/fixedbugs/bug404.dir/one.go
index 2024eb0..9fc4770 100644
--- a/test/fixedbugs/bug404.dir/one.go
+++ b/test/fixedbugs/bug404.dir/one.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug404.dir/two.go b/test/fixedbugs/bug404.dir/two.go
index 162eae7..0c70a23 100644
--- a/test/fixedbugs/bug404.dir/two.go
+++ b/test/fixedbugs/bug404.dir/two.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug406.go b/test/fixedbugs/bug406.go
index 6df3c5c..32cf3e3 100644
--- a/test/fixedbugs/bug406.go
+++ b/test/fixedbugs/bug406.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug407.dir/one.go b/test/fixedbugs/bug407.dir/one.go
index a91d904..c85b077 100644
--- a/test/fixedbugs/bug407.dir/one.go
+++ b/test/fixedbugs/bug407.dir/one.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug407.dir/two.go b/test/fixedbugs/bug407.dir/two.go
index 67e1852..640305c 100644
--- a/test/fixedbugs/bug407.dir/two.go
+++ b/test/fixedbugs/bug407.dir/two.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug409.go b/test/fixedbugs/bug409.go
index 1dca43b..9e08a8e 100644
--- a/test/fixedbugs/bug409.go
+++ b/test/fixedbugs/bug409.go
@@ -1,6 +1,6 @@
// cmpout
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug410.go b/test/fixedbugs/bug410.go
index 430ddcb..a4eef64 100644
--- a/test/fixedbugs/bug410.go
+++ b/test/fixedbugs/bug410.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug411.go b/test/fixedbugs/bug411.go
index 3b90db8..a1c36f6 100644
--- a/test/fixedbugs/bug411.go
+++ b/test/fixedbugs/bug411.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug412.go b/test/fixedbugs/bug412.go
index c7ddc0c..183fb7e 100644
--- a/test/fixedbugs/bug412.go
+++ b/test/fixedbugs/bug412.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug413.go b/test/fixedbugs/bug413.go
index ba80464..819bd1a 100644
--- a/test/fixedbugs/bug413.go
+++ b/test/fixedbugs/bug413.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug414.dir/p1.go b/test/fixedbugs/bug414.dir/p1.go
index 2463834..143e600 100644
--- a/test/fixedbugs/bug414.dir/p1.go
+++ b/test/fixedbugs/bug414.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug414.dir/prog.go b/test/fixedbugs/bug414.dir/prog.go
index f55d946..8945d65 100644
--- a/test/fixedbugs/bug414.dir/prog.go
+++ b/test/fixedbugs/bug414.dir/prog.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug414.go b/test/fixedbugs/bug414.go
index 35e19be..5b435b4 100644
--- a/test/fixedbugs/bug414.go
+++ b/test/fixedbugs/bug414.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug415.dir/p.go b/test/fixedbugs/bug415.dir/p.go
index b4152d6..e86a697 100644
--- a/test/fixedbugs/bug415.dir/p.go
+++ b/test/fixedbugs/bug415.dir/p.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug415.dir/prog.go b/test/fixedbugs/bug415.dir/prog.go
index b894453..1ffde18 100644
--- a/test/fixedbugs/bug415.dir/prog.go
+++ b/test/fixedbugs/bug415.dir/prog.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug415.go b/test/fixedbugs/bug415.go
index 8cd4c49..daf4f0c 100644
--- a/test/fixedbugs/bug415.go
+++ b/test/fixedbugs/bug415.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug416.go b/test/fixedbugs/bug416.go
index 1d24fa9..9fc3532 100644
--- a/test/fixedbugs/bug416.go
+++ b/test/fixedbugs/bug416.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug424.dir/lib.go b/test/fixedbugs/bug424.dir/lib.go
index 97054da..31df8c6 100644
--- a/test/fixedbugs/bug424.dir/lib.go
+++ b/test/fixedbugs/bug424.dir/lib.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug424.dir/main.go b/test/fixedbugs/bug424.dir/main.go
index c2fe146..28b41e6 100644
--- a/test/fixedbugs/bug424.dir/main.go
+++ b/test/fixedbugs/bug424.dir/main.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug424.go b/test/fixedbugs/bug424.go
index 59c2cd3..9c59abe 100644
--- a/test/fixedbugs/bug424.go
+++ b/test/fixedbugs/bug424.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug428.go b/test/fixedbugs/bug428.go
index 298c455..d9ad276 100644
--- a/test/fixedbugs/bug428.go
+++ b/test/fixedbugs/bug428.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug429.go b/test/fixedbugs/bug429.go
index 31d5a3a..2c31f32 100644
--- a/test/fixedbugs/bug429.go
+++ b/test/fixedbugs/bug429.go
@@ -1,6 +1,6 @@
// skip
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug435.go b/test/fixedbugs/bug435.go
index 0c2ac7b..692a492 100644
--- a/test/fixedbugs/bug435.go
+++ b/test/fixedbugs/bug435.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug437.dir/one.go b/test/fixedbugs/bug437.dir/one.go
index 8d3caad..633573e 100644
--- a/test/fixedbugs/bug437.dir/one.go
+++ b/test/fixedbugs/bug437.dir/one.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug437.dir/two.go b/test/fixedbugs/bug437.dir/two.go
index 406dd59..61da121 100644
--- a/test/fixedbugs/bug437.dir/two.go
+++ b/test/fixedbugs/bug437.dir/two.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug437.dir/x.go b/test/fixedbugs/bug437.dir/x.go
index 364d017..585b480 100644
--- a/test/fixedbugs/bug437.dir/x.go
+++ b/test/fixedbugs/bug437.dir/x.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug437.go b/test/fixedbugs/bug437.go
index 5c4a2ad..98adce7 100644
--- a/test/fixedbugs/bug437.go
+++ b/test/fixedbugs/bug437.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug441.go b/test/fixedbugs/bug441.go
index 8562bfe..b67125b 100644
--- a/test/fixedbugs/bug441.go
+++ b/test/fixedbugs/bug441.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug442.go b/test/fixedbugs/bug442.go
index 1d1a948..684d54f 100644
--- a/test/fixedbugs/bug442.go
+++ b/test/fixedbugs/bug442.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug443.go b/test/fixedbugs/bug443.go
index b67bd8c..9abd254 100644
--- a/test/fixedbugs/bug443.go
+++ b/test/fixedbugs/bug443.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug444.go b/test/fixedbugs/bug444.go
index b54fb4f..29a60f5 100644
--- a/test/fixedbugs/bug444.go
+++ b/test/fixedbugs/bug444.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug445.go b/test/fixedbugs/bug445.go
index 497ecd3..45c3290 100644
--- a/test/fixedbugs/bug445.go
+++ b/test/fixedbugs/bug445.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug447.go b/test/fixedbugs/bug447.go
index a4c871b..8358f00 100644
--- a/test/fixedbugs/bug447.go
+++ b/test/fixedbugs/bug447.go
@@ -1,6 +1,6 @@
// runoutput
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug448.dir/pkg1.go b/test/fixedbugs/bug448.dir/pkg1.go
index 032e5d9..291903c 100644
--- a/test/fixedbugs/bug448.dir/pkg1.go
+++ b/test/fixedbugs/bug448.dir/pkg1.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug448.dir/pkg2.go b/test/fixedbugs/bug448.dir/pkg2.go
index 5c78c7d..20d8509 100644
--- a/test/fixedbugs/bug448.dir/pkg2.go
+++ b/test/fixedbugs/bug448.dir/pkg2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug448.go b/test/fixedbugs/bug448.go
index 242f599..481acda 100644
--- a/test/fixedbugs/bug448.go
+++ b/test/fixedbugs/bug448.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug450.go b/test/fixedbugs/bug450.go
index 3f13de1..af27b72 100644
--- a/test/fixedbugs/bug450.go
+++ b/test/fixedbugs/bug450.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug452.go b/test/fixedbugs/bug452.go
index d2e4a0b..f1f8b08 100644
--- a/test/fixedbugs/bug452.go
+++ b/test/fixedbugs/bug452.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug453.go b/test/fixedbugs/bug453.go
index 136abef..1f4f3ea 100644
--- a/test/fixedbugs/bug453.go
+++ b/test/fixedbugs/bug453.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug454.go b/test/fixedbugs/bug454.go
index a10abba..9e3344d 100644
--- a/test/fixedbugs/bug454.go
+++ b/test/fixedbugs/bug454.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug455.go b/test/fixedbugs/bug455.go
index 8e3c770..9f6974d 100644
--- a/test/fixedbugs/bug455.go
+++ b/test/fixedbugs/bug455.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug456.go b/test/fixedbugs/bug456.go
index 064e1aa..c77a76d 100644
--- a/test/fixedbugs/bug456.go
+++ b/test/fixedbugs/bug456.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug457.go b/test/fixedbugs/bug457.go
index ee70489..84f8db4 100644
--- a/test/fixedbugs/bug457.go
+++ b/test/fixedbugs/bug457.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug458.go b/test/fixedbugs/bug458.go
index ddc97bd..6332697 100644
--- a/test/fixedbugs/bug458.go
+++ b/test/fixedbugs/bug458.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug459.go b/test/fixedbugs/bug459.go
index 014f2ef..c71cb1b 100644
--- a/test/fixedbugs/bug459.go
+++ b/test/fixedbugs/bug459.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug460.dir/a.go b/test/fixedbugs/bug460.dir/a.go
index 29049d9..51c6836 100644
--- a/test/fixedbugs/bug460.dir/a.go
+++ b/test/fixedbugs/bug460.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug460.dir/b.go b/test/fixedbugs/bug460.dir/b.go
index 5c0a0c4..ef64694 100644
--- a/test/fixedbugs/bug460.dir/b.go
+++ b/test/fixedbugs/bug460.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug460.go b/test/fixedbugs/bug460.go
index 79234a3..a1b6f47 100644
--- a/test/fixedbugs/bug460.go
+++ b/test/fixedbugs/bug460.go
@@ -1,6 +1,6 @@
// errorcheckdir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug461.go b/test/fixedbugs/bug461.go
index f0f7b0e..d7fe802 100644
--- a/test/fixedbugs/bug461.go
+++ b/test/fixedbugs/bug461.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug462.go b/test/fixedbugs/bug462.go
index 1a23ad0..3df63b0 100644
--- a/test/fixedbugs/bug462.go
+++ b/test/fixedbugs/bug462.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug463.go b/test/fixedbugs/bug463.go
index 3e7a184..c7f9237 100644
--- a/test/fixedbugs/bug463.go
+++ b/test/fixedbugs/bug463.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug464.go b/test/fixedbugs/bug464.go
index 5821939..3e2c18a 100644
--- a/test/fixedbugs/bug464.go
+++ b/test/fixedbugs/bug464.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug465.dir/a.go b/test/fixedbugs/bug465.dir/a.go
index a9a8614..3e5d012 100644
--- a/test/fixedbugs/bug465.dir/a.go
+++ b/test/fixedbugs/bug465.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug465.dir/b.go b/test/fixedbugs/bug465.dir/b.go
index c84c683..db7f731 100644
--- a/test/fixedbugs/bug465.dir/b.go
+++ b/test/fixedbugs/bug465.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug465.go b/test/fixedbugs/bug465.go
index a6ef587..84ff07b 100644
--- a/test/fixedbugs/bug465.go
+++ b/test/fixedbugs/bug465.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug466.dir/a.go b/test/fixedbugs/bug466.dir/a.go
index b9de63e..e27699c 100644
--- a/test/fixedbugs/bug466.dir/a.go
+++ b/test/fixedbugs/bug466.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug466.dir/b.go b/test/fixedbugs/bug466.dir/b.go
index 82d66ea..04e3626 100644
--- a/test/fixedbugs/bug466.dir/b.go
+++ b/test/fixedbugs/bug466.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug466.go b/test/fixedbugs/bug466.go
index 6b65b33..dc909d4 100644
--- a/test/fixedbugs/bug466.go
+++ b/test/fixedbugs/bug466.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug467.go b/test/fixedbugs/bug467.go
index d73adba..4126f92 100644
--- a/test/fixedbugs/bug467.go
+++ b/test/fixedbugs/bug467.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug468.dir/p1.go b/test/fixedbugs/bug468.dir/p1.go
index ca17577..cdda735 100644
--- a/test/fixedbugs/bug468.dir/p1.go
+++ b/test/fixedbugs/bug468.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug468.dir/p2.go b/test/fixedbugs/bug468.dir/p2.go
index 1793c0e..dbb4693 100644
--- a/test/fixedbugs/bug468.dir/p2.go
+++ b/test/fixedbugs/bug468.dir/p2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug468.go b/test/fixedbugs/bug468.go
index 12e4997..77941ce 100644
--- a/test/fixedbugs/bug468.go
+++ b/test/fixedbugs/bug468.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug470.go b/test/fixedbugs/bug470.go
index 0a35918..c21663f 100644
--- a/test/fixedbugs/bug470.go
+++ b/test/fixedbugs/bug470.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug471.go b/test/fixedbugs/bug471.go
index e454259..343661f 100644
--- a/test/fixedbugs/bug471.go
+++ b/test/fixedbugs/bug471.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/bug472.dir/p1.go b/test/fixedbugs/bug472.dir/p1.go
index 9d47fd8..cda1aa7 100644
--- a/test/fixedbugs/bug472.dir/p1.go
+++ b/test/fixedbugs/bug472.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug472.dir/p2.go b/test/fixedbugs/bug472.dir/p2.go
index 34a3f04..581ec40 100644
--- a/test/fixedbugs/bug472.dir/p2.go
+++ b/test/fixedbugs/bug472.dir/p2.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug472.dir/z.go b/test/fixedbugs/bug472.dir/z.go
index 6c29dd0..eb791bf 100644
--- a/test/fixedbugs/bug472.dir/z.go
+++ b/test/fixedbugs/bug472.dir/z.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug472.go b/test/fixedbugs/bug472.go
index c79c64c..6939e64 100644
--- a/test/fixedbugs/bug472.go
+++ b/test/fixedbugs/bug472.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug473.go b/test/fixedbugs/bug473.go
index 49ce7d7..7649b6b 100644
--- a/test/fixedbugs/bug473.go
+++ b/test/fixedbugs/bug473.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug474.go b/test/fixedbugs/bug474.go
index b826487..1efabe4 100644
--- a/test/fixedbugs/bug474.go
+++ b/test/fixedbugs/bug474.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug475.go b/test/fixedbugs/bug475.go
index 1bd6fa3..0145aab 100644
--- a/test/fixedbugs/bug475.go
+++ b/test/fixedbugs/bug475.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug476.go b/test/fixedbugs/bug476.go
index 563fd91..8695f95 100644
--- a/test/fixedbugs/bug476.go
+++ b/test/fixedbugs/bug476.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug477.go b/test/fixedbugs/bug477.go
index 86289af..f1fbffa 100644
--- a/test/fixedbugs/bug477.go
+++ b/test/fixedbugs/bug477.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug478.dir/a.go b/test/fixedbugs/bug478.dir/a.go
index a40e454..b5a2dbc 100644
--- a/test/fixedbugs/bug478.dir/a.go
+++ b/test/fixedbugs/bug478.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug478.dir/b.go b/test/fixedbugs/bug478.dir/b.go
index c0fdf11..cfd1d27 100644
--- a/test/fixedbugs/bug478.dir/b.go
+++ b/test/fixedbugs/bug478.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug478.go b/test/fixedbugs/bug478.go
index 5e339e8..8757f46 100644
--- a/test/fixedbugs/bug478.go
+++ b/test/fixedbugs/bug478.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug479.dir/a.go b/test/fixedbugs/bug479.dir/a.go
index 5ff3bef..eddb4cf 100644
--- a/test/fixedbugs/bug479.dir/a.go
+++ b/test/fixedbugs/bug479.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug479.dir/b.go b/test/fixedbugs/bug479.dir/b.go
index a1b27b3..9f3f5e8 100644
--- a/test/fixedbugs/bug479.dir/b.go
+++ b/test/fixedbugs/bug479.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug479.go b/test/fixedbugs/bug479.go
index f8a0f93..80012ba 100644
--- a/test/fixedbugs/bug479.go
+++ b/test/fixedbugs/bug479.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug480.dir/a.go b/test/fixedbugs/bug480.dir/a.go
index 6dff515..26a8d11 100644
--- a/test/fixedbugs/bug480.dir/a.go
+++ b/test/fixedbugs/bug480.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug480.dir/b.go b/test/fixedbugs/bug480.dir/b.go
index 6207365..5bd40f6 100644
--- a/test/fixedbugs/bug480.dir/b.go
+++ b/test/fixedbugs/bug480.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug480.go b/test/fixedbugs/bug480.go
index 5b44af4..ad2f73c 100644
--- a/test/fixedbugs/bug480.go
+++ b/test/fixedbugs/bug480.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug481.go b/test/fixedbugs/bug481.go
index d0922a5..13a5339 100644
--- a/test/fixedbugs/bug481.go
+++ b/test/fixedbugs/bug481.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug482.go b/test/fixedbugs/bug482.go
index 10c4828..0e5417d 100644
--- a/test/fixedbugs/bug482.go
+++ b/test/fixedbugs/bug482.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/bug483.go b/test/fixedbugs/bug483.go
index 2372e89..8db6425 100644
--- a/test/fixedbugs/bug483.go
+++ b/test/fixedbugs/bug483.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug484.go b/test/fixedbugs/bug484.go
index c664b83..bd4fa51 100644
--- a/test/fixedbugs/bug484.go
+++ b/test/fixedbugs/bug484.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
@@ -23,20 +23,14 @@
import "runtime"
-var c bool
-
+//go:noinline
func f() interface{} {
- if c { // disable inlining
- f()
- }
runtime.GC()
return nil
}
+//go:noinline
func g() {
- if c { // disable inlining
- g()
- }
var s interface{}
_ = func() {
s := f()
@@ -47,31 +41,25 @@
useiface(s)
}
+//go:noinline
func useiface(x interface{}) {
- if c { // disable inlining
- useiface(x)
- }
}
+//go:noinline
func h() {
- if c { // disable inlining
- h()
- }
var x [16]uintptr
for i := range x {
x[i] = 1
}
-
+
useint(x[0])
useint(x[1])
useint(x[2])
useint(x[3])
}
+//go:noinline
func useint(x uintptr) {
- if c { // disable inlining
- useint(x)
- }
}
func main() {
@@ -85,6 +73,6 @@
func big(x int) {
if x >= 0 {
- big(x-1)
+ big(x - 1)
}
}
diff --git a/test/fixedbugs/bug485.go b/test/fixedbugs/bug485.go
index 1544753..c99faed 100644
--- a/test/fixedbugs/bug485.go
+++ b/test/fixedbugs/bug485.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug486.go b/test/fixedbugs/bug486.go
index c1a4723..9ad23b3 100644
--- a/test/fixedbugs/bug486.go
+++ b/test/fixedbugs/bug486.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug487.go b/test/fixedbugs/bug487.go
index eb1ad5e..e60af6c 100644
--- a/test/fixedbugs/bug487.go
+++ b/test/fixedbugs/bug487.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug488.dir/a.go b/test/fixedbugs/bug488.dir/a.go
index 94eaf7f..fc49420 100644
--- a/test/fixedbugs/bug488.dir/a.go
+++ b/test/fixedbugs/bug488.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug488.dir/b.go b/test/fixedbugs/bug488.dir/b.go
index 21b4c5b..f93328c 100644
--- a/test/fixedbugs/bug488.dir/b.go
+++ b/test/fixedbugs/bug488.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug488.go b/test/fixedbugs/bug488.go
index 63a601e..3912deb 100644
--- a/test/fixedbugs/bug488.go
+++ b/test/fixedbugs/bug488.go
@@ -1,6 +1,6 @@
// errorcheckdir
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug489.go b/test/fixedbugs/bug489.go
index 4cf19e0..34250cd 100644
--- a/test/fixedbugs/bug489.go
+++ b/test/fixedbugs/bug489.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug490.go b/test/fixedbugs/bug490.go
index 7d05f39..387a680 100644
--- a/test/fixedbugs/bug490.go
+++ b/test/fixedbugs/bug490.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug491.go b/test/fixedbugs/bug491.go
index f4b58af..39a3509 100644
--- a/test/fixedbugs/bug491.go
+++ b/test/fixedbugs/bug491.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/bug496.go b/test/fixedbugs/bug496.go
new file mode 100644
index 0000000..4307c75
--- /dev/null
+++ b/test/fixedbugs/bug496.go
@@ -0,0 +1,29 @@
+// compile
+
+// Copyright 2015 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.
+
+// Gccgo used to give an error:
+// <built-in>: error: redefinition of ‘s$F$hash’
+// <built-in>: note: previous definition of ‘s$F$hash’ was here
+// <built-in>: error: redefinition of ‘s$F$equal’
+// <built-in>: note: previous definition of ‘s$F$equal’ was here
+
+package p
+
+type T1 int
+
+func (t T1) F() {
+ type s struct {
+ f string
+ }
+}
+
+type T2 int
+
+func (t T2) F() {
+ type s struct {
+ f string
+ }
+}
diff --git a/test/fixedbugs/bug497.go b/test/fixedbugs/bug497.go
new file mode 100644
index 0000000..7081b1c
--- /dev/null
+++ b/test/fixedbugs/bug497.go
@@ -0,0 +1,28 @@
+// run
+
+// Copyright 2015 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.
+
+// Gccgo used to miscompile passing a global variable with a
+// zero-sized type to a function.
+
+package main
+
+type T struct {
+ field s
+}
+
+type s struct{}
+
+var X T
+
+func F(_ T, c interface{}) int {
+ return len(c.(string))
+}
+
+func main() {
+ if v := F(X, "hi"); v != 2 {
+ panic(v)
+ }
+}
diff --git a/test/fixedbugs/gcc61204.go b/test/fixedbugs/gcc61204.go
index 5a5bb16..e175f83 100644
--- a/test/fixedbugs/gcc61204.go
+++ b/test/fixedbugs/gcc61204.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61244.go b/test/fixedbugs/gcc61244.go
index 7fbc872..642bc61 100644
--- a/test/fixedbugs/gcc61244.go
+++ b/test/fixedbugs/gcc61244.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61246.go b/test/fixedbugs/gcc61246.go
index 4866570..797d6c7 100644
--- a/test/fixedbugs/gcc61246.go
+++ b/test/fixedbugs/gcc61246.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61248.go b/test/fixedbugs/gcc61248.go
index 593c634..cb59c9f 100644
--- a/test/fixedbugs/gcc61248.go
+++ b/test/fixedbugs/gcc61248.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61253.go b/test/fixedbugs/gcc61253.go
index dc125ac..696b26e 100644
--- a/test/fixedbugs/gcc61253.go
+++ b/test/fixedbugs/gcc61253.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61254.go b/test/fixedbugs/gcc61254.go
index 36ac7d4..82e666e 100644
--- a/test/fixedbugs/gcc61254.go
+++ b/test/fixedbugs/gcc61254.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61255.go b/test/fixedbugs/gcc61255.go
index a0e6d18..288fb54 100644
--- a/test/fixedbugs/gcc61255.go
+++ b/test/fixedbugs/gcc61255.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61258.go b/test/fixedbugs/gcc61258.go
index 8474665..e4dcb33 100644
--- a/test/fixedbugs/gcc61258.go
+++ b/test/fixedbugs/gcc61258.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61264.go b/test/fixedbugs/gcc61264.go
index d4e05f4..a4092f5 100644
--- a/test/fixedbugs/gcc61264.go
+++ b/test/fixedbugs/gcc61264.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61265.go b/test/fixedbugs/gcc61265.go
index 42fae36..be79233 100644
--- a/test/fixedbugs/gcc61265.go
+++ b/test/fixedbugs/gcc61265.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc61273.go b/test/fixedbugs/gcc61273.go
index 2983222..ed78b1e 100644
--- a/test/fixedbugs/gcc61273.go
+++ b/test/fixedbugs/gcc61273.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/gcc65755.go b/test/fixedbugs/gcc65755.go
index e76f4d1..1e5d116 100644
--- a/test/fixedbugs/gcc65755.go
+++ b/test/fixedbugs/gcc65755.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/gcc67968.dir/a.go b/test/fixedbugs/gcc67968.dir/a.go
new file mode 100644
index 0000000..9f51a7a
--- /dev/null
+++ b/test/fixedbugs/gcc67968.dir/a.go
@@ -0,0 +1,12 @@
+// Copyright 2015 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
+
+type T int
+
+func (a *T) Foo() [1]string {
+ var r [1]string
+ return r
+}
diff --git a/test/fixedbugs/gcc67968.dir/b.go b/test/fixedbugs/gcc67968.dir/b.go
new file mode 100644
index 0000000..41b62d2
--- /dev/null
+++ b/test/fixedbugs/gcc67968.dir/b.go
@@ -0,0 +1,12 @@
+// Copyright 2015 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"
+
+func F() (interface{}) {
+ var v *a.T
+ return v.Foo()
+}
diff --git a/test/fixedbugs/gcc67968.go b/test/fixedbugs/gcc67968.go
new file mode 100644
index 0000000..8db3dd8
--- /dev/null
+++ b/test/fixedbugs/gcc67968.go
@@ -0,0 +1,14 @@
+// compiledir
+
+// Copyright 2015 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.
+
+// https://gcc.gnu.org/PR67968
+
+// gccgo compiler crash building the equality and hash functions for a
+// type when a return statement requires a conversion to interface
+// type of a call of function defined in a different package that
+// returns an unnamed type.
+
+package ignored
diff --git a/test/fixedbugs/issue10047.go b/test/fixedbugs/issue10047.go
index 1cb9c24..dcbde48 100644
--- a/test/fixedbugs/issue10047.go
+++ b/test/fixedbugs/issue10047.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue10284.go b/test/fixedbugs/issue10284.go
index e89d6f4..39028e7 100644
--- a/test/fixedbugs/issue10284.go
+++ b/test/fixedbugs/issue10284.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue10320.go b/test/fixedbugs/issue10320.go
index 697aad1..c7e2bab 100644
--- a/test/fixedbugs/issue10320.go
+++ b/test/fixedbugs/issue10320.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue10332.go b/test/fixedbugs/issue10332.go
index e00a8b4..096b7a5 100644
--- a/test/fixedbugs/issue10332.go
+++ b/test/fixedbugs/issue10332.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue10407.go b/test/fixedbugs/issue10407.go
index fe033ef..c6461a3 100644
--- a/test/fixedbugs/issue10407.go
+++ b/test/fixedbugs/issue10407.go
@@ -1,6 +1,6 @@
// runoutput
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue10441.go b/test/fixedbugs/issue10441.go
index 25832fa..9bc4948 100644
--- a/test/fixedbugs/issue10441.go
+++ b/test/fixedbugs/issue10441.go
@@ -11,7 +11,7 @@
foo(&f)
}
+//go:noinline
func foo(f *func()) func() {
- defer func() {}() // prevent inlining of foo
return *f
}
diff --git a/test/fixedbugs/issue10486.go b/test/fixedbugs/issue10486.go
index f346828..3b62cb9 100644
--- a/test/fixedbugs/issue10486.go
+++ b/test/fixedbugs/issue10486.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue10975.go b/test/fixedbugs/issue10975.go
new file mode 100644
index 0000000..b5f043f
--- /dev/null
+++ b/test/fixedbugs/issue10975.go
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2015 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 10975: Returning an invalid interface would cause
+// `internal compiler error: getinarg: not a func`.
+
+package main
+
+type I interface {
+ int // ERROR "interface contains embedded non-interface int"
+}
+
+func New() I {
+ return struct{}{}
+}
diff --git a/test/fixedbugs/issue11053.dir/p.go b/test/fixedbugs/issue11053.dir/p.go
index e431cb4..81b412a 100644
--- a/test/fixedbugs/issue11053.dir/p.go
+++ b/test/fixedbugs/issue11053.dir/p.go
@@ -1,4 +1,4 @@
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue11053.dir/p_test.go b/test/fixedbugs/issue11053.dir/p_test.go
index e0a9555..542c2a3 100644
--- a/test/fixedbugs/issue11053.dir/p_test.go
+++ b/test/fixedbugs/issue11053.dir/p_test.go
@@ -1,4 +1,4 @@
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue11326.go b/test/fixedbugs/issue11326.go
index fd1fab3..82754c7 100644
--- a/test/fixedbugs/issue11326.go
+++ b/test/fixedbugs/issue11326.go
@@ -1,28 +1,31 @@
// errorcheck
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
+// Tests for golang.org/issue/11326.
+
package main
-import "fmt"
-
func main() {
- var g = 1e81391777742999 // ERROR "exponent too large"
- // The next should only cause a problem when converted to float64
- // by the assignment, but instead the compiler rejects it outright,
- // rather than mishandle it. Specifically, when handled, 'var h' prints:
- // issue11326.go:N: constant 0.93342e+536870911 overflows float64
- // The rejection of 'var i' is just insurance. It seems to work correctly.
- // See golang.org/issue/11326.
- // var h = 1e2147483647 // should be "1.00000e+2147483647 overflows float64"
- var h = 1e2147483647 // ERROR "exponent too large"
- // var i = 1e214748364 // should be "1.00000e\+214748364 overflows float64"
- var i = 1e214748364 // ERROR "exponent too large"
- var j = 1e21474836 // ERROR "1.00000e\+21474836 overflows float64"
- var k = 1e2147483 // ERROR "1.00000e\+2147483 overflows float64"
- var l = 1e214748 // ERROR "1.00000e\+214748 overflows float64"
- var m = 1e21474 // ERROR "1.00000e\+21474 overflows float64"
- fmt.Println(g)
+ // The gc compiler implementation uses the minimally required 32bit
+ // binary exponent, so these constants cannot be represented anymore
+ // internally. However, the language spec does not preclude other
+ // implementations from handling these. Don't check the error.
+ // var _ = 1e2147483647 // "constant too large"
+ // var _ = 1e646456993 // "constant too large"
+
+ // Any implementation must be able to handle these constants at
+ // compile time (even though they cannot be assigned to a float64).
+ var _ = 1e646456992 // ERROR "1e\+646456992 overflows float64"
+ var _ = 1e64645699 // ERROR "1e\+64645699 overflows float64"
+ var _ = 1e6464569 // ERROR "1e\+6464569 overflows float64"
+ var _ = 1e646456 // ERROR "1e\+646456 overflows float64"
+ var _ = 1e64645 // ERROR "1e\+64645 overflows float64"
+ var _ = 1e6464 // ERROR "1e\+6464 overflows float64"
+ var _ = 1e646 // ERROR "1e\+646 overflows float64"
+ var _ = 1e309 // ERROR "1e\+309 overflows float64"
+
+ var _ = 1e308
}
diff --git a/test/fixedbugs/issue11326b.go b/test/fixedbugs/issue11326b.go
index 00effbc..8aba4d9 100644
--- a/test/fixedbugs/issue11326b.go
+++ b/test/fixedbugs/issue11326b.go
@@ -1,41 +1,41 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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 main
+// Tests for golang.org/issue/11326.
+
func main() {
- /* TODO(rsc): Should work but does not. See golang.org/issue/11326.
{
- const n = 1e2147483647
- const d = 1e2147483646
+ const n = 1e646456992
+ const d = 1e646456991
x := n / d
if x != 10.0 {
println("incorrect value:", x)
}
}
{
- const n = 1e214748364
- const d = 1e214748363
- x := n / d
- if x != 10.0 {
- println("incorrect value:", x)
- }
- }
- */
- {
- const n = 1e21474836
- const d = 1e21474835
+ const n = 1e64645699
+ const d = 1e64645698
x := n / d
if x != 10.0 {
println("incorrect value:", x)
}
}
{
- const n = 1e2147483
- const d = 1e2147482
+ const n = 1e6464569
+ const d = 1e6464568
+ x := n / d
+ if x != 10.0 {
+ println("incorrect value:", x)
+ }
+ }
+ {
+ const n = 1e646456
+ const d = 1e646455
x := n / d
if x != 10.0 {
println("incorrect value:", x)
diff --git a/test/fixedbugs/issue11359.go b/test/fixedbugs/issue11359.go
new file mode 100644
index 0000000..6ffffed
--- /dev/null
+++ b/test/fixedbugs/issue11359.go
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// identifiers beginning with non-ASCII digits were incorrectly accepted.
+// issue 11359.
+
+package p
+var Û¶ = 0 // ERROR "identifier cannot begin with digit"
diff --git a/test/fixedbugs/issue11361.go b/test/fixedbugs/issue11361.go
new file mode 100644
index 0000000..d01776b
--- /dev/null
+++ b/test/fixedbugs/issue11361.go
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2016 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
+
+import "fmt" // ERROR "imported and not used"
+
+const n = fmt // ERROR "fmt without selector" "fmt is not a constant"
diff --git a/test/fixedbugs/issue11362.go b/test/fixedbugs/issue11362.go
new file mode 100644
index 0000000..9e9e599
--- /dev/null
+++ b/test/fixedbugs/issue11362.go
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2015 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 11362: prints empty canonical import path
+
+package main
+
+import _ "unicode//utf8" // ERROR "non-canonical import path .unicode//utf8. \(should be .unicode/utf8.\)" "can't find import: .unicode//utf8."
+
+func main() {
+}
+
diff --git a/test/fixedbugs/issue11590.go b/test/fixedbugs/issue11590.go
new file mode 100644
index 0000000..0934547
--- /dev/null
+++ b/test/fixedbugs/issue11590.go
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2015 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 p
+
+var _ = int8(4) * 300 // ERROR "constant 300 overflows int8" "constant 1200 overflows int8"
+var _ = complex64(1) * 1e200 // ERROR "constant 1e\+200 overflows complex64"
+var _ = complex128(1) * 1e500 // ERROR "constant 1e\+500 overflows complex128"
diff --git a/test/fixedbugs/issue11610.go b/test/fixedbugs/issue11610.go
new file mode 100644
index 0000000..f32d480
--- /dev/null
+++ b/test/fixedbugs/issue11610.go
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Test an internal compiler error on ? symbol in declaration
+// following an empty import.
+
+package a
+import"" // ERROR "import path is empty"
+var? // ERROR "illegal character U\+003F '\?'"
+
+var x int // ERROR "unexpected var" "cannot declare name"
+
+func main() {
+}
diff --git a/test/fixedbugs/issue11614.go b/test/fixedbugs/issue11614.go
new file mode 100644
index 0000000..959643a
--- /dev/null
+++ b/test/fixedbugs/issue11614.go
@@ -0,0 +1,26 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Test that incorrect expressions involving wrong anonymous interface
+// do not generate panics in Type Stringer.
+// Does not compile.
+
+package main
+
+type I interface {
+ int // ERROR "interface contains embedded non-interface int"
+}
+
+func n() {
+ (I) // ERROR "type I is not an expression"
+}
+
+func m() {
+ (interface{int}) // ERROR "interface contains embedded non-interface int" "type interface { int } is not an expression"
+}
+
+func main() {
+}
diff --git a/test/fixedbugs/issue11656.go b/test/fixedbugs/issue11656.go
index 90385bb..e0ef097 100644
--- a/test/fixedbugs/issue11656.go
+++ b/test/fixedbugs/issue11656.go
@@ -1,29 +1,18 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
-// darwin/386 seems to mangle the PC and SP before
-// it manages to invoke the signal handler, so this test fails there.
-// +build !darwin !386
-//
-// openbsd/386 and netbsd/386 don't work, not sure why.
-// +build !openbsd !386
-// +build !netbsd !386
-//
// windows doesn't work, because Windows exception handling
// delivers signals based on the current PC, and that current PC
// doesn't go into the Go runtime.
// +build !windows
-//
-// arm64 gets "illegal instruction" (why is the data executable?)
-// and is unable to do the traceback correctly (why?).
-// +build !arm64
package main
import (
+ "encoding/binary"
"runtime"
"runtime/debug"
"unsafe"
@@ -56,7 +45,33 @@
var f struct {
x uintptr
}
- f.x = uintptr(unsafe.Pointer(&f))
+
+ // We want to force an illegal instruction, to get a crash
+ // at a PC value != 0.
+ // Not all systems make the data section non-executable.
+ ill := make([]byte, 64)
+ switch runtime.GOARCH {
+ case "386", "amd64":
+ binary.LittleEndian.PutUint16(ill, 0x0b0f) // ud2
+ case "arm":
+ binary.LittleEndian.PutUint32(ill, 0xe7f000f0) // no name, but permanently undefined
+ case "arm64":
+ binary.LittleEndian.PutUint32(ill, 0xd4207d00) // brk #1000
+ case "ppc64":
+ binary.BigEndian.PutUint32(ill, 0x7fe00008) // trap
+ case "ppc64le":
+ binary.LittleEndian.PutUint32(ill, 0x7fe00008) // trap
+ case "mips64":
+ binary.BigEndian.PutUint32(ill, 0x00000034) // trap
+ case "mips64le":
+ binary.LittleEndian.PutUint32(ill, 0x00000034) // trap
+ case "s390x":
+ binary.BigEndian.PutUint32(ill, 0) // undefined instruction
+ default:
+ // Just leave it as 0 and hope for the best.
+ }
+
+ f.x = uintptr(unsafe.Pointer(&ill[0]))
fn := *(*func())(unsafe.Pointer(&f))
fn()
}
diff --git a/test/fixedbugs/issue11699.go b/test/fixedbugs/issue11699.go
new file mode 100644
index 0000000..755e9a1
--- /dev/null
+++ b/test/fixedbugs/issue11699.go
@@ -0,0 +1,12 @@
+// compile
+
+// Copyright 2015 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 11699; used to fail with duplicate _.args_stackmap symbols.
+
+package p
+
+func _()
+func _()
diff --git a/test/fixedbugs/issue11737.go b/test/fixedbugs/issue11737.go
new file mode 100644
index 0000000..86ecf9a
--- /dev/null
+++ b/test/fixedbugs/issue11737.go
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2015 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 11737 - invalid == not being caught until generated switch code was compiled
+
+package p
+
+func f()
+
+func s(x interface{}) {
+ switch x {
+ case f: // ERROR "invalid case f \(type func\(\)\) in switch \(incomparable type\)"
+ }
+}
diff --git a/test/fixedbugs/issue11750.go b/test/fixedbugs/issue11750.go
index 5e6fe60..d5a2b22 100644
--- a/test/fixedbugs/issue11750.go
+++ b/test/fixedbugs/issue11750.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue11771.go b/test/fixedbugs/issue11771.go
index 7691ca6..d91fc5d 100644
--- a/test/fixedbugs/issue11771.go
+++ b/test/fixedbugs/issue11771.go
@@ -1,7 +1,7 @@
// +build !nacl
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue11790.go b/test/fixedbugs/issue11790.go
index d7669f8..096b297 100644
--- a/test/fixedbugs/issue11790.go
+++ b/test/fixedbugs/issue11790.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue11987.go b/test/fixedbugs/issue11987.go
new file mode 100644
index 0000000..9b665dc
--- /dev/null
+++ b/test/fixedbugs/issue11987.go
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2015 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 11987. The ppc64 SRADCC instruction was misassembled in a way
+// lost bit 5 of the immediate so v>>32 was assembled as v>>0. SRADCC
+// is only ever inserted by peep so it's hard to be sure when it will
+// be used. This formulation worked when the bug was fixed.
+
+package main
+
+import "fmt"
+
+var v int64 = 0x80000000
+
+func main() {
+ s := fmt.Sprintf("%v", v>>32 == 0)
+ if s != "true" {
+ fmt.Printf("BUG: v>>32 == 0 evaluated as %q\n", s)
+ }
+}
diff --git a/test/fixedbugs/issue12006.go b/test/fixedbugs/issue12006.go
new file mode 100644
index 0000000..9d81a04
--- /dev/null
+++ b/test/fixedbugs/issue12006.go
@@ -0,0 +1,174 @@
+// errorcheck -0 -m -l
+
+// Copyright 2015 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.
+
+// Test escape analysis through ... parameters.
+
+package foo
+
+func FooN(vals ...*int) (s int) { // ERROR "FooN vals does not escape"
+ for _, v := range vals {
+ s += *v
+ }
+ return s
+}
+
+// Append forces heap allocation and copies entries in vals to heap, therefore they escape to heap.
+func FooNx(x *int, vals ...*int) (s int) { // ERROR "leaking param: x" "leaking param content: vals"
+ vals = append(vals, x)
+ return FooN(vals...)
+}
+
+var sink []*int
+
+func FooNy(x *int, vals ...*int) (s int) { // ERROR "leaking param: x" "leaking param: vals" "leaking param content: vals"
+ vals = append(vals, x)
+ sink = vals
+ return FooN(vals...)
+}
+
+func FooNz(vals ...*int) (s int) { // ERROR "leaking param: vals"
+ sink = vals
+ return FooN(vals...)
+}
+
+func TFooN() {
+ for i := 0; i < 1000; i++ {
+ var i, j int
+ FooN(&i, &j) // ERROR "TFooN &i does not escape" "TFooN &j does not escape" "TFooN ... argument does not escape"
+ }
+}
+
+func TFooNx() {
+ for i := 0; i < 1000; i++ {
+ var i, j, k int // ERROR "moved to heap: i" "moved to heap: j" "moved to heap: k"
+ FooNx(&k, &i, &j) // ERROR "&k escapes to heap" "&i escapes to heap" "&j escapes to heap" "TFooNx ... argument does not escape"
+ }
+}
+
+func TFooNy() {
+ for i := 0; i < 1000; i++ {
+ var i, j, k int // ERROR "moved to heap: i" "moved to heap: j" "moved to heap: k"
+ FooNy(&k, &i, &j) // ERROR "&i escapes to heap" "&j escapes to heap" "&k escapes to heap" "... argument escapes to heap"
+ }
+}
+
+func TFooNz() {
+ for i := 0; i < 1000; i++ {
+ var i, j int // ERROR "moved to heap: i" "moved to heap: j"
+ FooNz(&i, &j) // ERROR "&i escapes to heap" "&j escapes to heap" "... argument escapes to heap"
+ }
+}
+
+var isink *int32
+
+func FooI(args ...interface{}) { // ERROR "leaking param content: args"
+ for i := 0; i < len(args); i++ {
+ switch x := args[i].(type) {
+ case nil:
+ println("is nil")
+ case int32:
+ println("is int32")
+ case *int32:
+ println("is *int32")
+ isink = x
+ case string:
+ println("is string")
+ }
+ }
+}
+
+func TFooI() {
+ a := int32(1) // ERROR "moved to heap: a"
+ b := "cat"
+ c := &a // ERROR "&a escapes to heap"
+ FooI(a, b, c) // ERROR "a escapes to heap" "b escapes to heap" "c escapes to heap" "TFooI ... argument does not escape"
+}
+
+func FooJ(args ...interface{}) *int32 { // ERROR "leaking param: args to result ~r1 level=1"
+ for i := 0; i < len(args); i++ {
+ switch x := args[i].(type) {
+ case nil:
+ println("is nil")
+ case int32:
+ println("is int32")
+ case *int32:
+ println("is *int32")
+ return x
+ case string:
+ println("is string")
+ }
+ }
+ return nil
+}
+
+func TFooJ1() {
+ a := int32(1)
+ b := "cat"
+ c := &a // ERROR "TFooJ1 &a does not escape"
+ FooJ(a, b, c) // ERROR "TFooJ1 a does not escape" "TFooJ1 b does not escape" "TFooJ1 c does not escape" "TFooJ1 ... argument does not escape"
+}
+
+func TFooJ2() {
+ a := int32(1) // ERROR "moved to heap: a"
+ b := "cat"
+ c := &a // ERROR "&a escapes to heap"
+ isink = FooJ(a, b, c) // ERROR "a escapes to heap" "b escapes to heap" "c escapes to heap" "TFooJ2 ... argument does not escape"
+}
+
+type fakeSlice struct {
+ l int
+ a *[4]interface{}
+}
+
+func FooK(args fakeSlice) *int32 { // ERROR "leaking param: args to result ~r1 level=1"
+ for i := 0; i < args.l; i++ {
+ switch x := (*args.a)[i].(type) {
+ case nil:
+ println("is nil")
+ case int32:
+ println("is int32")
+ case *int32:
+ println("is *int32")
+ return x
+ case string:
+ println("is string")
+ }
+ }
+ return nil
+}
+
+func TFooK2() {
+ a := int32(1) // ERROR "moved to heap: a"
+ b := "cat"
+ c := &a // ERROR "&a escapes to heap"
+ fs := fakeSlice{3, &[4]interface{}{a, b, c, nil}} // ERROR "a escapes to heap" "b escapes to heap" "c escapes to heap" "TFooK2 &\[4\]interface {} literal does not escape"
+ isink = FooK(fs)
+}
+
+func FooL(args []interface{}) *int32 { // ERROR "leaking param: args to result ~r1 level=1"
+ for i := 0; i < len(args); i++ {
+ switch x := args[i].(type) {
+ case nil:
+ println("is nil")
+ case int32:
+ println("is int32")
+ case *int32:
+ println("is *int32")
+ return x
+ case string:
+ println("is string")
+ }
+ }
+ return nil
+}
+
+func TFooL2() {
+ a := int32(1) // ERROR "moved to heap: a"
+ b := "cat"
+ c := &a // ERROR "&a escapes to heap"
+ s := []interface{}{a, b, c} // ERROR "a escapes to heap" "b escapes to heap" "c escapes to heap" "TFooL2 \[\]interface {} literal does not escape"
+ isink = FooL(s)
+}
diff --git a/test/fixedbugs/issue12108.go b/test/fixedbugs/issue12108.go
new file mode 100644
index 0000000..c7a7425
--- /dev/null
+++ b/test/fixedbugs/issue12108.go
@@ -0,0 +1,37 @@
+// run
+
+// Copyright 2015 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.
+
+// A generated method with a return value large enough to be
+// initialized by duffzero is not a leaf method, which violated
+// assumptions made by cmd/internal/obj/ppc64.
+
+package main
+
+const N = 9 // values > 8 cause (Super).Method to use duffzero
+
+type Base struct {
+}
+
+func (b *Base) Method() (x [N]uintptr) {
+ return
+}
+
+type Super struct {
+ Base
+}
+
+type T interface {
+ Method() [N]uintptr
+}
+
+func f(q T) {
+ q.Method()
+}
+
+func main() {
+ var s Super
+ f(&s)
+}
diff --git a/test/fixedbugs/issue12133.go b/test/fixedbugs/issue12133.go
index 0b66c56..bbf9fb0 100644
--- a/test/fixedbugs/issue12133.go
+++ b/test/fixedbugs/issue12133.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
@@ -19,8 +19,8 @@
panic("bad")
}
}
+
+//go:noinline
func f1(v1 uint) uint {
- switch {
- } // prevent inlining
return v1 >> ((1 >> v1) + (1 >> v1))
}
diff --git a/test/fixedbugs/issue12347.go b/test/fixedbugs/issue12347.go
new file mode 100644
index 0000000..fc5678e
--- /dev/null
+++ b/test/fixedbugs/issue12347.go
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2015 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 p
+
+func f_ssa(x int, p *int) {
+ if false {
+ y := x + 5
+ for {
+ *p = y
+ }
+ }
+}
diff --git a/test/fixedbugs/issue12411.go b/test/fixedbugs/issue12411.go
new file mode 100644
index 0000000..ff49314
--- /dev/null
+++ b/test/fixedbugs/issue12411.go
@@ -0,0 +1,24 @@
+// +build !386
+// run
+
+// Copyright 2015 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 12411. Loss of AX during %.
+
+package main
+
+func main() {
+ x := f(4)
+ if x != 0 {
+ println("BUG: x=", x)
+ }
+}
+
+//go:noinline
+func f(x int) int {
+ // AX was live on entry to one of the % code generations,
+ // and the % code generation smashed it.
+ return ((2 * x) % 3) % (2 % ((x << 2) ^ (x % 3)))
+}
diff --git a/test/fixedbugs/issue12413.go b/test/fixedbugs/issue12413.go
new file mode 100644
index 0000000..a054765
--- /dev/null
+++ b/test/fixedbugs/issue12413.go
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2015 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 12413: invalid variable name x in type switch: code would fail
+// to compile if the variable used in the short variable declaration was
+// previously declared as a constant.
+
+package main
+
+func main() {
+ const x = 42
+ switch x := interface{}(nil).(type) {
+ default:
+ _ = x
+ }
+}
diff --git a/test/fixedbugs/issue12525.go b/test/fixedbugs/issue12525.go
new file mode 100644
index 0000000..4a54eab
--- /dev/null
+++ b/test/fixedbugs/issue12525.go
@@ -0,0 +1,26 @@
+// errorcheck
+
+// Copyright 2016 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 12525: confusing error trying to increment boolean value
+
+package main
+
+func main() {
+ var i int
+ i++
+
+ var f float64
+ f++
+
+ var c complex128
+ c++
+
+ var b bool
+ b++ // ERROR "invalid operation: b\+\+ \(non-numeric type bool\)"
+
+ var s string
+ s-- // ERROR "invalid operation: s-- \(non-numeric type string\)"
+}
diff --git a/test/fixedbugs/issue12577.go b/test/fixedbugs/issue12577.go
new file mode 100644
index 0000000..249b4f2
--- /dev/null
+++ b/test/fixedbugs/issue12577.go
@@ -0,0 +1,66 @@
+// run
+
+// Copyright 2015 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 12577: Test that there are no -0 floating-point constants.
+
+package main
+
+import "math"
+
+const (
+ z0 = 0.0
+ z1 = -0.0
+ z2 = -z0
+ z3 = -z2
+)
+
+var (
+ x0 float32 = z0
+ x1 float32 = z1
+ x2 float32 = z2
+ x3 float32 = z3
+
+ y0 float64 = z0
+ y1 float64 = z1
+ y2 float64 = z2
+ y3 float64 = z3
+)
+
+func test32(f float32) {
+ if f != 0 || math.Signbit(float64(f)) {
+ println("BUG: got", f, "want 0.0")
+ return
+ }
+}
+
+func test64(f float64) {
+ if f != 0 || math.Signbit(f) {
+ println("BUG: got", f, "want 0.0")
+ return
+ }
+}
+
+func main() {
+ if f := -x0; f != 0 || !math.Signbit(float64(f)) {
+ println("BUG: got", f, "want -0.0")
+ }
+
+ test32(-0.0)
+ test32(x0)
+ test32(x1)
+ test32(x2)
+ test32(x3)
+
+ if f := -y0; f != 0 || !math.Signbit(f) {
+ println("BUG: got", f, "want -0.0")
+ }
+
+ test64(-0.0)
+ test64(y0)
+ test64(y1)
+ test64(y2)
+ test64(y3)
+}
diff --git a/test/fixedbugs/issue12588.go b/test/fixedbugs/issue12588.go
new file mode 100644
index 0000000..87f1d47
--- /dev/null
+++ b/test/fixedbugs/issue12588.go
@@ -0,0 +1,88 @@
+// errorcheck -0 -m -l
+
+// Copyright 2015 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.
+
+// Tests escape analysis for range of arrays.
+// Compiles but need not run. Inlining is disabled.
+
+package main
+
+type A struct {
+ b [3]uint64
+}
+
+type B struct {
+ b [3]*uint64
+}
+
+func f(a A) int {
+ for i, x := range &a.b { // ERROR "f &a.b does not escape"
+ if x != 0 {
+ return 64*i + int(x)
+ }
+ }
+ return 0
+}
+
+func g(a *A) int { // ERROR "g a does not escape"
+ for i, x := range &a.b { // ERROR "g &a.b does not escape"
+ if x != 0 {
+ return 64*i + int(x)
+ }
+ }
+ return 0
+}
+
+func h(a *B) *uint64 { // ERROR "leaking param: a to result ~r1 level=1"
+ for i, x := range &a.b { // ERROR "h &a.b does not escape"
+ if i == 0 {
+ return x
+ }
+ }
+ return nil
+}
+
+func h2(a *B) *uint64 { // ERROR "leaking param: a to result ~r1 level=1"
+ p := &a.b // ERROR "h2 &a.b does not escape"
+ for i, x := range p {
+ if i == 0 {
+ return x
+ }
+ }
+ return nil
+}
+
+// Seems like below should be level=1, not 0.
+func k(a B) *uint64 { // ERROR "leaking param: a to result ~r1 level=0"
+ for i, x := range &a.b { // ERROR "k &a.b does not escape"
+ if i == 0 {
+ return x
+ }
+ }
+ return nil
+}
+
+var sink *uint64
+
+func main() {
+ var a1, a2 A
+ var b1, b2, b3, b4 B
+ var x1, x2, x3, x4 uint64 // ERROR "moved to heap: x1" "moved to heap: x3"
+ b1.b[0] = &x1 // ERROR "&x1 escapes to heap"
+ b2.b[0] = &x2 // ERROR "main &x2 does not escape"
+ b3.b[0] = &x3 // ERROR "&x3 escapes to heap"
+ b4.b[0] = &x4 // ERROR "main &x4 does not escape"
+ f(a1)
+ g(&a2) // ERROR "main &a2 does not escape"
+ sink = h(&b1) // ERROR "main &b1 does not escape"
+ h(&b2) // ERROR "main &b2 does not escape"
+ sink = h2(&b1) // ERROR "main &b1 does not escape"
+ h2(&b4) // ERROR "main &b4 does not escape"
+ x1 = 17
+ println("*sink=", *sink) // Verify that sink addresses x1
+ x3 = 42
+ sink = k(b3)
+ println("*sink=", *sink) // Verify that sink addresses x3
+}
diff --git a/test/fixedbugs/issue12677.dir/p.go b/test/fixedbugs/issue12677.dir/p.go
new file mode 100644
index 0000000..e395071
--- /dev/null
+++ b/test/fixedbugs/issue12677.dir/p.go
@@ -0,0 +1,8 @@
+// Copyright 2015 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 p
+func Baz(f int) float64 {
+ return 1 / float64(int(1)<<(uint(f)))
+}
diff --git a/test/fixedbugs/issue12677.dir/q.go b/test/fixedbugs/issue12677.dir/q.go
new file mode 100644
index 0000000..fd39c8a
--- /dev/null
+++ b/test/fixedbugs/issue12677.dir/q.go
@@ -0,0 +1,7 @@
+// Copyright 2015 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 q
+import "./p"
+func f() { println(p.Baz(2)) }
diff --git a/test/fixedbugs/issue12677.go b/test/fixedbugs/issue12677.go
new file mode 100644
index 0000000..6ad7161
--- /dev/null
+++ b/test/fixedbugs/issue12677.go
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2015 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 12677: Type loss during export/import of inlined function body.
+
+package ignored
diff --git a/test/fixedbugs/issue12686.go b/test/fixedbugs/issue12686.go
new file mode 100644
index 0000000..bde4255
--- /dev/null
+++ b/test/fixedbugs/issue12686.go
@@ -0,0 +1,16 @@
+// compile
+
+// Copyright 2015 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.
+
+// golang.org/issue/12686.
+// interesting because it's a non-constant but ideal value
+// and we used to incorrectly attach a constant Val to the Node.
+
+package p
+
+func f(i uint) uint {
+ x := []uint{1 << i}
+ return x[0]
+}
diff --git a/test/fixedbugs/issue12944.go b/test/fixedbugs/issue12944.go
new file mode 100644
index 0000000..59379f1
--- /dev/null
+++ b/test/fixedbugs/issue12944.go
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2015 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 main
+
+import "unsafe"
+
+const (
+ _ = unsafe.Sizeof([0]byte{}[0]) // ERROR "out of bounds"
+)
diff --git a/test/fixedbugs/issue1304.go b/test/fixedbugs/issue1304.go
index 1206e18..9e0ca5a 100644
--- a/test/fixedbugs/issue1304.go
+++ b/test/fixedbugs/issue1304.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue13160.go b/test/fixedbugs/issue13160.go
new file mode 100644
index 0000000..c21ecf6
--- /dev/null
+++ b/test/fixedbugs/issue13160.go
@@ -0,0 +1,70 @@
+// run
+
+// Copyright 2015 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 main
+
+import (
+ "fmt"
+ "runtime"
+)
+
+const N = 100000
+
+func main() {
+ // Allocate more Ps than processors. This raises
+ // the chance that we get interrupted by the OS
+ // in exactly the right (wrong!) place.
+ p := runtime.NumCPU()
+ runtime.GOMAXPROCS(2 * p)
+
+ // Allocate some pointers.
+ ptrs := make([]*int, p)
+ for i := 0; i < p; i++ {
+ ptrs[i] = new(int)
+ }
+
+ // Arena where we read and write pointers like crazy.
+ collider := make([]*int, p)
+
+ done := make(chan struct{}, 2*p)
+
+ // Start writers. They alternately write a pointer
+ // and nil to a slot in the collider.
+ for i := 0; i < p; i++ {
+ i := i
+ go func() {
+ for j := 0; j < N; j++ {
+ // Write a pointer using memmove.
+ copy(collider[i:i+1], ptrs[i:i+1])
+ // Write nil using memclr.
+ // (This is a magic loop that gets lowered to memclr.)
+ r := collider[i : i+1]
+ for k := range r {
+ r[k] = nil
+ }
+ }
+ done <- struct{}{}
+ }()
+ }
+ // Start readers. They read pointers from slots
+ // and make sure they are valid.
+ for i := 0; i < p; i++ {
+ i := i
+ go func() {
+ for j := 0; j < N; j++ {
+ var ptr [1]*int
+ copy(ptr[:], collider[i:i+1])
+ if ptr[0] != nil && ptr[0] != ptrs[i] {
+ panic(fmt.Sprintf("bad pointer read %p!", ptr[0]))
+ }
+ }
+ done <- struct{}{}
+ }()
+ }
+ for i := 0; i < 2*p; i++ {
+ <-done
+ }
+}
diff --git a/test/fixedbugs/issue13169.go b/test/fixedbugs/issue13169.go
new file mode 100644
index 0000000..03c52e2
--- /dev/null
+++ b/test/fixedbugs/issue13169.go
@@ -0,0 +1,49 @@
+// run
+
+// Copyright 2015 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 main
+
+type T struct {
+ a, b, c int
+}
+
+func usestack() {
+ usestack1(32)
+}
+func usestack1(d int) byte {
+ if d == 0 {
+ return 0
+ }
+ var b [1024]byte
+ usestack1(d - 1)
+ return b[3]
+}
+
+const n = 100000
+
+func main() {
+ c := make(chan interface{})
+ done := make(chan bool)
+
+ for i := 0; i < 10; i++ {
+ go func() {
+ for j := 0; j < n; j++ {
+ c <- new(T)
+ }
+ done <- true
+ }()
+ go func() {
+ for j := 0; j < n; j++ {
+ _ = (<-c).(*T)
+ usestack()
+ }
+ done <- true
+ }()
+ }
+ for i := 0; i < 20; i++ {
+ <-done
+ }
+}
diff --git a/test/fixedbugs/issue13171.go b/test/fixedbugs/issue13171.go
new file mode 100644
index 0000000..5d127a5
--- /dev/null
+++ b/test/fixedbugs/issue13171.go
@@ -0,0 +1,34 @@
+// run
+
+// Copyright 2015 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 main
+
+// Make sure the compiler knows that DUFFCOPY clobbers X0
+
+import "fmt"
+
+//go:noinline
+func f(x float64) float64 {
+ // y is allocated to X0
+ y := x + 5
+ // marshals z before y. Marshalling z
+ // calls DUFFCOPY.
+ return g(z, y)
+}
+
+//go:noinline
+func g(b [64]byte, y float64) float64 {
+ return y
+}
+
+var z [64]byte
+
+func main() {
+ got := f(5)
+ if got != 10 {
+ panic(fmt.Sprintf("want 10, got %f", got))
+ }
+}
diff --git a/test/fixedbugs/issue13248.go b/test/fixedbugs/issue13248.go
new file mode 100644
index 0000000..5246281
--- /dev/null
+++ b/test/fixedbugs/issue13248.go
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// This program caused an infinite loop with the recursive-descent parser.
+
+package main
+
+func main() {
+ foo(
+} // ERROR "unexpected }"
diff --git a/test/fixedbugs/issue13261.go b/test/fixedbugs/issue13261.go
new file mode 100644
index 0000000..a944f3a
--- /dev/null
+++ b/test/fixedbugs/issue13261.go
@@ -0,0 +1,29 @@
+// compile
+
+// Copyright 2015 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.
+
+// Taking the address of a parenthesized composite literal is permitted.
+
+package main
+
+type T struct{}
+
+func main() {
+ _ = &T{}
+ _ = &(T{})
+ _ = &((T{}))
+
+ _ = &struct{}{}
+ _ = &(struct{}{})
+ _ = &((struct{}{}))
+
+ switch (&T{}) {}
+ switch &(T{}) {}
+ switch &((T{})) {}
+
+ switch &struct{}{} {}
+ switch &(struct{}{}) {}
+ switch &((struct{}{})) {}
+}
diff --git a/test/fixedbugs/issue13266.go b/test/fixedbugs/issue13266.go
new file mode 100644
index 0000000..37c5594
--- /dev/null
+++ b/test/fixedbugs/issue13266.go
@@ -0,0 +1,10 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Offending character % must not be interpreted as
+// start of format verb when emitting error message.
+
+package% // ERROR "unexpected %"
diff --git a/test/fixedbugs/issue13268.go b/test/fixedbugs/issue13268.go
new file mode 100644
index 0000000..2a063fa
--- /dev/null
+++ b/test/fixedbugs/issue13268.go
@@ -0,0 +1,48 @@
+// run
+
+// Copyright 2015 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.
+
+// Test error message when EOF is encountered in the
+// middle of a BOM.
+//
+// Since the error requires an EOF, we cannot use the
+// errorcheckoutput mechanism.
+
+package main
+
+import (
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "runtime"
+ "strings"
+)
+
+func main() {
+ // cannot use temp file on nacl via child process
+ if runtime.GOOS == "nacl" {
+ return
+ }
+
+ // create source
+ f, err := ioutil.TempFile("", "issue13268-")
+ if err != nil {
+ log.Fatalf("could not create source file: %v", err)
+ }
+ f.Write([]byte("package p\n\nfunc \xef\xef")) // if this fails, we will die later
+ f.Close()
+ defer os.Remove(f.Name())
+
+ // compile and test output
+ cmd := exec.Command("go", "tool", "compile", f.Name())
+ out, err := cmd.CombinedOutput()
+ if err == nil {
+ log.Fatalf("expected cmd/compile to fail")
+ }
+ if strings.HasPrefix(string(out), "illegal UTF-8 sequence") {
+ log.Fatalf("error %q not found", out)
+ }
+}
diff --git a/test/fixedbugs/issue13273.go b/test/fixedbugs/issue13273.go
new file mode 100644
index 0000000..f8f679d
--- /dev/null
+++ b/test/fixedbugs/issue13273.go
@@ -0,0 +1,55 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Check that we correctly construct (and report errors)
+// for unary expressions of the form <-x where we only
+// know after parsing x whether <-x is a receive operation
+// or a channel type.
+
+package n
+
+func f() {
+ // test case from issue 13273
+ <-chan int((chan int)(nil))
+
+ <-chan int(nil)
+ <-chan chan int(nil)
+ <-chan chan chan int(nil)
+ <-chan chan chan chan int(nil)
+ <-chan chan chan chan chan int(nil)
+
+ <-chan<-chan int(nil)
+ <-chan<-chan<-chan int(nil)
+ <-chan<-chan<-chan<-chan int(nil)
+ <-chan<-chan<-chan<-chan<-chan int(nil)
+
+ <-chan (<-chan int)(nil)
+ <-chan (<-chan (<-chan int))(nil)
+ <-chan (<-chan (<-chan (<-chan int)))(nil)
+ <-chan (<-chan (<-chan (<-chan (<-chan int))))(nil)
+
+ <-(<-chan int)(nil)
+ <-(<-chan chan int)(nil)
+ <-(<-chan chan chan int)(nil)
+ <-(<-chan chan chan chan int)(nil)
+ <-(<-chan chan chan chan chan int)(nil)
+
+ <-(<-chan<-chan int)(nil)
+ <-(<-chan<-chan<-chan int)(nil)
+ <-(<-chan<-chan<-chan<-chan int)(nil)
+ <-(<-chan<-chan<-chan<-chan<-chan int)(nil)
+
+ <-(<-chan (<-chan int))(nil)
+ <-(<-chan (<-chan (<-chan int)))(nil)
+ <-(<-chan (<-chan (<-chan (<-chan int))))(nil)
+ <-(<-chan (<-chan (<-chan (<-chan (<-chan int)))))(nil)
+
+ type _ <-<-chan int // ERROR "unexpected <-, expecting chan"
+ <-<-chan int // ERROR "unexpected <-, expecting chan|expecting {" (new parser: same error as for type decl)
+
+ type _ <-chan<-int // ERROR "unexpected int, expecting chan|expecting chan"
+ <-chan<-int // ERROR "unexpected int, expecting chan|expecting {" (new parser: same error as for type decl)
+}
diff --git a/test/fixedbugs/issue13274.go b/test/fixedbugs/issue13274.go
new file mode 100644
index 0000000..480f5bc
--- /dev/null
+++ b/test/fixedbugs/issue13274.go
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Check that we don't ignore EOF.
+
+package p
+
+var f = func() { // ERROR "unexpected EOF"
\ No newline at end of file
diff --git a/test/fixedbugs/issue13319.go b/test/fixedbugs/issue13319.go
new file mode 100644
index 0000000..c9b4896
--- /dev/null
+++ b/test/fixedbugs/issue13319.go
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2015 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 main
+
+func f(int, int) {
+ switch x {
+ case 1:
+ f(1, g() // ERROR "expecting \)|expecting comma or \)"
+ case 2:
+ f()
+ case 3:
+ f(1, g() // ERROR "expecting \)|expecting comma or \)"
+ }
+}
diff --git a/test/fixedbugs/issue13337.go b/test/fixedbugs/issue13337.go
new file mode 100644
index 0000000..81f984b
--- /dev/null
+++ b/test/fixedbugs/issue13337.go
@@ -0,0 +1,30 @@
+// compile
+
+// Copyright 2016 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 13337: The Go compiler limited how deeply embedded types
+// were searched for promoted fields and methods.
+
+package s
+
+type S0 struct{ f int }
+func (S0) m() {}
+
+type S1 struct{ S0 }
+type S2 struct{ S1 }
+type S3 struct{ S2 }
+type S4 struct{ S3 }
+type S5 struct{ S4 }
+type S6 struct{ S5 }
+type S7 struct{ S6 }
+type S8 struct{ S7 }
+type S9 struct{ S8 }
+type S10 struct{ S9 }
+type S11 struct{ S10 }
+type S12 struct{ S11 }
+type S13 struct{ S12 }
+
+var _ = S13{}.f
+var _ = S13.m
diff --git a/test/fixedbugs/issue13365.go b/test/fixedbugs/issue13365.go
new file mode 100644
index 0000000..379f9b6
--- /dev/null
+++ b/test/fixedbugs/issue13365.go
@@ -0,0 +1,25 @@
+// errorcheck
+
+// Copyright 2015 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 13365: confusing error message (array vs slice)
+
+package main
+
+var t struct{}
+
+func main() {
+ _ = []int{-1: 0} // ERROR "index must be non\-negative integer constant"
+ _ = [10]int{-1: 0} // ERROR "index must be non\-negative integer constant"
+ _ = [...]int{-1: 0} // ERROR "index must be non\-negative integer constant"
+
+ _ = []int{100: 0}
+ _ = [10]int{100: 0} // ERROR "array index 100 out of bounds"
+ _ = [...]int{100: 0}
+
+ _ = []int{t} // ERROR "cannot use .* as type int in array or slice literal"
+ _ = [10]int{t} // ERROR "cannot use .* as type int in array or slice literal"
+ _ = [...]int{t} // ERROR "cannot use .* as type int in array or slice literal"
+}
diff --git a/test/fixedbugs/issue13415.go b/test/fixedbugs/issue13415.go
new file mode 100644
index 0000000..989a1ed
--- /dev/null
+++ b/test/fixedbugs/issue13415.go
@@ -0,0 +1,19 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that error message regarding := appears on
+// correct line (and not on the line of the 2nd :=).
+
+package p
+
+func f() {
+ select {
+ case x, x := <-func() chan int { // ERROR "x repeated on left side of :="
+ c := make(chan int)
+ return c
+ }():
+ }
+}
diff --git a/test/fixedbugs/issue13471.go b/test/fixedbugs/issue13471.go
new file mode 100644
index 0000000..81f034b
--- /dev/null
+++ b/test/fixedbugs/issue13471.go
@@ -0,0 +1,25 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Tests for golang.org/issue/13471
+
+package main
+
+func main() {
+ const _ int64 = 1e646456992 // ERROR "1e\+646456992 overflows integer"
+ const _ int32 = 1e64645699 // ERROR "1e\+64645699 overflows integer"
+ const _ int16 = 1e6464569 // ERROR "1e\+6464569 overflows integer"
+ const _ int8 = 1e646456 // ERROR "1e\+646456 overflows integer"
+ const _ int = 1e64645 // ERROR "1e\+64645 overflows integer"
+
+ const _ uint64 = 1e646456992 // ERROR "1e\+646456992 overflows integer"
+ const _ uint32 = 1e64645699 // ERROR "1e\+64645699 overflows integer"
+ const _ uint16 = 1e6464569 // ERROR "1e\+6464569 overflows integer"
+ const _ uint8 = 1e646456 // ERROR "1e\+646456 overflows integer"
+ const _ uint = 1e64645 // ERROR "1e\+64645 overflows integer"
+
+ const _ rune = 1e64645 // ERROR "1e\+64645 overflows integer"
+}
diff --git a/test/fixedbugs/issue13480.go b/test/fixedbugs/issue13480.go
new file mode 100644
index 0000000..cd2f05d
--- /dev/null
+++ b/test/fixedbugs/issue13480.go
@@ -0,0 +1,38 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that comparisons of slice/map/func values against converted nil
+// values are properly rejected.
+
+package p
+
+func bug() {
+ type S []byte
+ type M map[int]int
+ type F func()
+
+ var s S
+ var m M
+ var f F
+
+ _ = s == S(nil) // ERROR "compare.*to nil"
+ _ = S(nil) == s // ERROR "compare.*to nil"
+ switch s {
+ case S(nil): // ERROR "compare.*to nil"
+ }
+
+ _ = m == M(nil) // ERROR "compare.*to nil"
+ _ = M(nil) == m // ERROR "compare.*to nil"
+ switch m {
+ case M(nil): // ERROR "compare.*to nil"
+ }
+
+ _ = f == F(nil) // ERROR "compare.*to nil"
+ _ = F(nil) == f // ERROR "compare.*to nil"
+ switch f {
+ case F(nil): // ERROR "compare.*to nil"
+ }
+}
diff --git a/test/fixedbugs/issue13539.go b/test/fixedbugs/issue13539.go
new file mode 100644
index 0000000..72c3ab0
--- /dev/null
+++ b/test/fixedbugs/issue13539.go
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that a label named like a package is recognized
+// as a label rather than a package and that the package
+// remains unused.
+
+package main
+
+import "math" // ERROR "imported and not used"
+
+func main() {
+math:
+ for {
+ break math
+ }
+}
diff --git a/test/fixedbugs/issue13559.go b/test/fixedbugs/issue13559.go
new file mode 100644
index 0000000..4783c62
--- /dev/null
+++ b/test/fixedbugs/issue13559.go
@@ -0,0 +1,89 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that error messages print meaningful values
+// for various extreme floating-point constants.
+
+package p
+
+// failure case in issue
+const _ int64 = 1e-10000 // ERROR "1e\-10000 truncated"
+
+const (
+ _ int64 = 1e10000000 // ERROR "1e\+10000000 overflows"
+ _ int64 = 1e1000000 // ERROR "1e\+1000000 overflows"
+ _ int64 = 1e100000 // ERROR "1e\+100000 overflows"
+ _ int64 = 1e10000 // ERROR "1e\+10000 overflows"
+ _ int64 = 1e1000 // ERROR "1e\+1000 overflows"
+ _ int64 = 1e100 // ERROR "10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
+ _ int64 = 1e10
+ _ int64 = 1e1
+ _ int64 = 1e0
+ _ int64 = 1e-1 // ERROR "0\.1 truncated"
+ _ int64 = 1e-10 // ERROR "1e\-10 truncated"
+ _ int64 = 1e-100 // ERROR "1e\-100 truncated"
+ _ int64 = 1e-1000 // ERROR "1e\-1000 truncated"
+ _ int64 = 1e-10000 // ERROR "1e\-10000 truncated"
+ _ int64 = 1e-100000 // ERROR "1e\-100000 truncated"
+ _ int64 = 1e-1000000 // ERROR "1e\-1000000 truncated"
+)
+
+const (
+ _ int64 = -1e10000000 // ERROR "\-1e\+10000000 overflows"
+ _ int64 = -1e1000000 // ERROR "\-1e\+1000000 overflows"
+ _ int64 = -1e100000 // ERROR "\-1e\+100000 overflows"
+ _ int64 = -1e10000 // ERROR "\-1e\+10000 overflows"
+ _ int64 = -1e1000 // ERROR "\-1e\+1000 overflows"
+ _ int64 = -1e100 // ERROR "\-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
+ _ int64 = -1e10
+ _ int64 = -1e1
+ _ int64 = -1e0
+ _ int64 = -1e-1 // ERROR "\-0\.1 truncated"
+ _ int64 = -1e-10 // ERROR "\-1e\-10 truncated"
+ _ int64 = -1e-100 // ERROR "\-1e\-100 truncated"
+ _ int64 = -1e-1000 // ERROR "\-1e\-1000 truncated"
+ _ int64 = -1e-10000 // ERROR "\-1e\-10000 truncated"
+ _ int64 = -1e-100000 // ERROR "\-1e\-100000 truncated"
+ _ int64 = -1e-1000000 // ERROR "\-1e\-1000000 truncated"
+)
+
+const (
+ _ int64 = 1.23456789e10000000 // ERROR "1\.23457e\+10000000 overflows"
+ _ int64 = 1.23456789e1000000 // ERROR "1\.23457e\+1000000 overflows"
+ _ int64 = 1.23456789e100000 // ERROR "1\.23457e\+100000 overflows"
+ _ int64 = 1.23456789e10000 // ERROR "1\.23457e\+10000 overflows"
+ _ int64 = 1.23456789e1000 // ERROR "1\.23457e\+1000 overflows"
+ _ int64 = 1.23456789e100 // ERROR "12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
+ _ int64 = 1.23456789e10
+ _ int64 = 1.23456789e1 // ERROR "12\.3457 truncated"
+ _ int64 = 1.23456789e0 // ERROR "1\.23457 truncated"
+ _ int64 = 1.23456789e-1 // ERROR "0\.123457 truncated"
+ _ int64 = 1.23456789e-10 // ERROR "1\.23457e\-10 truncated"
+ _ int64 = 1.23456789e-100 // ERROR "1\.23457e\-100 truncated"
+ _ int64 = 1.23456789e-1000 // ERROR "1\.23457e\-1000 truncated"
+ _ int64 = 1.23456789e-10000 // ERROR "1\.23457e\-10000 truncated"
+ _ int64 = 1.23456789e-100000 // ERROR "1\.23457e\-100000 truncated"
+ _ int64 = 1.23456789e-1000000 // ERROR "1\.23457e\-1000000 truncated"
+)
+
+const (
+ _ int64 = -1.23456789e10000000 // ERROR "\-1\.23457e\+10000000 overflows"
+ _ int64 = -1.23456789e1000000 // ERROR "\-1\.23457e\+1000000 overflows"
+ _ int64 = -1.23456789e100000 // ERROR "\-1\.23457e\+100000 overflows"
+ _ int64 = -1.23456789e10000 // ERROR "\-1\.23457e\+10000 overflows"
+ _ int64 = -1.23456789e1000 // ERROR "\-1\.23457e\+1000 overflows"
+ _ int64 = -1.23456789e100 // ERROR "\-12345678900000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 overflows"
+ _ int64 = -1.23456789e10
+ _ int64 = -1.23456789e1 // ERROR "\-12\.3457 truncated"
+ _ int64 = -1.23456789e0 // ERROR "\-1\.23457 truncated"
+ _ int64 = -1.23456789e-1 // ERROR "\-0\.123457 truncated"
+ _ int64 = -1.23456789e-10 // ERROR "\-1\.23457e\-10 truncated"
+ _ int64 = -1.23456789e-100 // ERROR "\-1\.23457e\-100 truncated"
+ _ int64 = -1.23456789e-1000 // ERROR "\-1\.23457e\-1000 truncated"
+ _ int64 = -1.23456789e-10000 // ERROR "\-1\.23457e\-10000 truncated"
+ _ int64 = -1.23456789e-100000 // ERROR "\-1\.23457e\-100000 truncated"
+ _ int64 = -1.23456789e-1000000 // ERROR "\-1\.23457e\-1000000 truncated"
+)
diff --git a/test/fixedbugs/issue13587.go b/test/fixedbugs/issue13587.go
new file mode 100644
index 0000000..b71bf9d
--- /dev/null
+++ b/test/fixedbugs/issue13587.go
@@ -0,0 +1,19 @@
+// errorcheck -0 -l -d=wb
+
+// Copyright 2015 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.
+
+// Test write barrier for implicit assignments to result parameters
+// that have escaped to the heap.
+
+package issue13587
+
+import "errors"
+
+func escape(p *error)
+
+func F() (err error) {
+ escape(&err)
+ return errors.New("error") // ERROR "write barrier"
+}
diff --git a/test/fixedbugs/issue13684.go b/test/fixedbugs/issue13684.go
new file mode 100644
index 0000000..a1d8856
--- /dev/null
+++ b/test/fixedbugs/issue13684.go
@@ -0,0 +1,17 @@
+// run
+
+// Copyright 2015 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.
+
+// Verify that a label name matching a constant name
+// is permitted.
+
+package main
+
+const labelname = 1
+
+func main() {
+ goto labelname
+labelname:
+}
diff --git a/test/fixedbugs/issue13777.dir/burnin.go b/test/fixedbugs/issue13777.dir/burnin.go
new file mode 100644
index 0000000..5125639
--- /dev/null
+++ b/test/fixedbugs/issue13777.dir/burnin.go
@@ -0,0 +1,19 @@
+package burnin
+
+type sendCmdFunc func(string)
+
+func sendCommand(c string) {}
+
+func NewSomething() {
+ // This works...
+ // var sendCmd sendCmdFunc
+ // sendCmd = sendCommand
+
+ // So does this...
+ //sendCmd := sendCmdFunc(sendCommand)
+
+ // This fails...
+ sendCmd := sendCommand
+
+ _ = sendCmd
+}
diff --git a/test/fixedbugs/issue13777.dir/main.go b/test/fixedbugs/issue13777.dir/main.go
new file mode 100644
index 0000000..2512b93
--- /dev/null
+++ b/test/fixedbugs/issue13777.dir/main.go
@@ -0,0 +1,11 @@
+// build
+
+package main
+
+import (
+ x "./burnin"
+)
+
+func main() {
+ x.NewSomething()
+}
diff --git a/test/fixedbugs/issue13777.go b/test/fixedbugs/issue13777.go
new file mode 100644
index 0000000..8f83c13
--- /dev/null
+++ b/test/fixedbugs/issue13777.go
@@ -0,0 +1,7 @@
+// rundir
+
+// Copyright 2015 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 ignored
diff --git a/test/fixedbugs/issue13779.go b/test/fixedbugs/issue13779.go
new file mode 100644
index 0000000..b18577c
--- /dev/null
+++ b/test/fixedbugs/issue13779.go
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2016 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 13779: provide better error message when directly assigning to struct field in map
+
+package main
+
+func main() {
+ type person struct{ age, weight, height int }
+ students := map[string]person{"sally": person{12, 50, 32}}
+ students["sally"].age = 3 // ERROR "cannot assign to struct field .* in map"
+}
diff --git a/test/fixedbugs/issue13799.go b/test/fixedbugs/issue13799.go
new file mode 100644
index 0000000..4819b5a
--- /dev/null
+++ b/test/fixedbugs/issue13799.go
@@ -0,0 +1,190 @@
+// errorcheck -0 -m -l
+
+// Copyright 2015 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.
+
+// Test, using compiler diagnostic flags, that the escape analysis is working.
+// Compiles but does not run. Inlining is disabled.
+// Registerization is disabled too (-N), which should
+// have no effect on escape analysis.
+
+package main
+
+import "fmt"
+
+func main() {
+ // Just run test over and over again. This main func is just for
+ // convenience; if test were the main func, we could also trigger
+ // the panic just by running the program over and over again
+ // (sometimes it takes 1 time, sometimes it takes ~4,000+).
+ for iter := 0; ; iter++ {
+ if iter%50 == 0 {
+ fmt.Println(iter) // ERROR "iter escapes to heap$" "main ... argument does not escape$"
+ }
+ test1(iter)
+ test2(iter)
+ test3(iter)
+ test4(iter)
+ test5(iter)
+ test6(iter)
+ }
+}
+
+func test1(iter int) {
+
+ const maxI = 500
+ m := make(map[int][]int) // ERROR "make\(map\[int\]\[\]int\) escapes to heap$"
+
+ // The panic seems to be triggered when m is modified inside a
+ // closure that is both recursively called and reassigned to in a
+ // loop.
+
+ // Cause of bug -- escape of closure failed to escape (shared) data structures
+ // of map. Assign to fn declared outside of loop triggers escape of closure.
+ // Heap -> stack pointer eventually causes badness when stack reallocation
+ // occurs.
+
+ var fn func() // ERROR "moved to heap: fn$"
+ for i := 0; i < maxI; i++ { // ERROR "moved to heap: i$"
+ // var fn func() // this makes it work, because fn stays off heap
+ j := 0 // ERROR "moved to heap: j$"
+ fn = func() { // ERROR "func literal escapes to heap$"
+ m[i] = append(m[i], 0) // ERROR "&i escapes to heap$"
+ if j < 25 { // ERROR "&j escapes to heap$"
+ j++
+ fn() // ERROR "&fn escapes to heap$"
+ }
+ }
+ fn()
+ }
+
+ if len(m) != maxI {
+ panic(fmt.Sprintf("iter %d: maxI = %d, len(m) = %d", iter, maxI, len(m))) // ERROR "iter escapes to heap$" "len\(m\) escapes to heap$" "maxI escapes to heap$" "test1 ... argument does not escape$"
+ }
+}
+
+func test2(iter int) {
+
+ const maxI = 500
+ m := make(map[int][]int) // ERROR "test2 make\(map\[int\]\[\]int\) does not escape$"
+
+ // var fn func()
+ for i := 0; i < maxI; i++ {
+ var fn func() // this makes it work, because fn stays off heap
+ j := 0
+ fn = func() { // ERROR "test2 func literal does not escape$"
+ m[i] = append(m[i], 0)
+ if j < 25 {
+ j++
+ fn()
+ }
+ }
+ fn()
+ }
+
+ if len(m) != maxI {
+ panic(fmt.Sprintf("iter %d: maxI = %d, len(m) = %d", iter, maxI, len(m))) // ERROR "iter escapes to heap$" "len\(m\) escapes to heap$" "maxI escapes to heap$" "test2 ... argument does not escape$"
+ }
+}
+
+func test3(iter int) {
+
+ const maxI = 500
+ var x int // ERROR "moved to heap: x$"
+ m := &x // ERROR "&x escapes to heap$"
+
+ var fn func() // ERROR "moved to heap: fn$"
+ for i := 0; i < maxI; i++ {
+ // var fn func() // this makes it work, because fn stays off heap
+ j := 0 // ERROR "moved to heap: j$"
+ fn = func() { // ERROR "func literal escapes to heap$"
+ if j < 100 { // ERROR "&j escapes to heap$"
+ j++
+ fn() // ERROR "&fn escapes to heap$"
+ } else {
+ *m = *m + 1
+ }
+ }
+ fn()
+ }
+
+ if *m != maxI {
+ panic(fmt.Sprintf("iter %d: maxI = %d, *m = %d", iter, maxI, *m)) // ERROR "\*m escapes to heap$" "iter escapes to heap$" "maxI escapes to heap$" "test3 ... argument does not escape$"
+ }
+}
+
+func test4(iter int) {
+
+ const maxI = 500
+ var x int
+ m := &x // ERROR "test4 &x does not escape$"
+
+ // var fn func()
+ for i := 0; i < maxI; i++ {
+ var fn func() // this makes it work, because fn stays off heap
+ j := 0
+ fn = func() { // ERROR "test4 func literal does not escape$"
+ if j < 100 {
+ j++
+ fn()
+ } else {
+ *m = *m + 1
+ }
+ }
+ fn()
+ }
+
+ if *m != maxI {
+ panic(fmt.Sprintf("iter %d: maxI = %d, *m = %d", iter, maxI, *m)) // ERROR "\*m escapes to heap$" "iter escapes to heap$" "maxI escapes to heap$" "test4 ... argument does not escape$"
+ }
+}
+
+type str struct {
+ m *int
+}
+
+func recur1(j int, s *str) { // ERROR "recur1 s does not escape"
+ if j < 100 {
+ j++
+ recur1(j, s)
+ } else {
+ *s.m++
+ }
+}
+
+func test5(iter int) {
+
+ const maxI = 500
+ var x int // ERROR "moved to heap: x$"
+ m := &x // ERROR "&x escapes to heap$"
+
+ var fn *str
+ for i := 0; i < maxI; i++ {
+ // var fn *str // this makes it work, because fn stays off heap
+ fn = &str{m} // ERROR "&str literal escapes to heap"
+ recur1(0, fn)
+ }
+
+ if *m != maxI {
+ panic(fmt.Sprintf("iter %d: maxI = %d, *m = %d", iter, maxI, *m)) // ERROR "\*m escapes to heap$" "iter escapes to heap$" "maxI escapes to heap$" "test5 ... argument does not escape$"
+ }
+}
+
+func test6(iter int) {
+
+ const maxI = 500
+ var x int
+ m := &x // ERROR "&x does not escape$"
+
+ // var fn *str
+ for i := 0; i < maxI; i++ {
+ var fn *str // this makes it work, because fn stays off heap
+ fn = &str{m} // ERROR "&str literal does not escape"
+ recur1(0, fn)
+ }
+
+ if *m != maxI {
+ panic(fmt.Sprintf("iter %d: maxI = %d, *m = %d", iter, maxI, *m)) // ERROR "\*m escapes to heap$" "iter escapes to heap$" "maxI escapes to heap$" "test6 ... argument does not escape$"
+ }
+}
diff --git a/test/fixedbugs/issue13821.go b/test/fixedbugs/issue13821.go
new file mode 100644
index 0000000..187e4b4
--- /dev/null
+++ b/test/fixedbugs/issue13821.go
@@ -0,0 +1,15 @@
+// compile
+
+// Copyright 2015 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 13821. Compiler rejected "bool(true)" as not a constant.
+
+package p
+
+const (
+ A = true
+ B = bool(A)
+ C = bool(true)
+)
diff --git a/test/fixedbugs/issue13821b.go b/test/fixedbugs/issue13821b.go
new file mode 100644
index 0000000..be67cea
--- /dev/null
+++ b/test/fixedbugs/issue13821b.go
@@ -0,0 +1,24 @@
+// errorcheck
+
+// Copyright 2015 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 13821. Additional regress tests.
+
+package p
+
+type B bool
+type B2 bool
+
+var b B
+var b2 B2
+var x1 = b && 1 < 2 // x1 has type B, not ideal bool
+var x2 = 1 < 2 && b // x2 has type B, not ideal bool
+var x3 = b && b2 // ERROR "mismatched types B and B2"
+var x4 = x1 && b2 // ERROR "mismatched types B and B2"
+var x5 = x2 && b2 // ERROR "mismatched types B and B2"
+var x6 = b2 && x1 // ERROR "mismatched types B2 and B"
+var x7 = b2 && x2 // ERROR "mismatched types B2 and B"
+
+var x8 = b && !B2(true) // ERROR "mismatched types B and B2"
diff --git a/test/fixedbugs/issue14006.go b/test/fixedbugs/issue14006.go
new file mode 100644
index 0000000..c3c56b1
--- /dev/null
+++ b/test/fixedbugs/issue14006.go
@@ -0,0 +1,64 @@
+// errorcheck
+
+// Copyright 2016 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.
+
+// Literals that happen to resolve to named constants
+// may be used as label names (see issue 13684). Make
+// sure that other literals don't crash the compiler.
+
+package main
+
+const labelname = 1
+
+func main() {
+ goto labelname
+labelname:
+}
+
+func f() {
+ var x int
+ switch x {
+ case 1:
+ 2: // ERROR "unexpected :"
+ case 2:
+ }
+
+ switch x {
+ case 1:
+ 2: ; // ERROR "unexpected :"
+ case 2:
+ }
+
+ var y string
+ switch y {
+ case "foo":
+ "bar": // ERROR "unexpected :"
+ case "bar":
+ }
+
+ switch y {
+ case "foo":
+ "bar": ; // ERROR "unexpected :"
+ case "bar":
+ }
+
+ var z bool
+ switch {
+ case z:
+ labelname: // ERROR "missing statement after label"
+ case false:
+ }
+
+ switch {
+ case z:
+ labelname:
+ }
+
+ switch {
+ case z:
+ labelname: ;
+ case false:
+ }
+}
\ No newline at end of file
diff --git a/test/fixedbugs/issue14010.go b/test/fixedbugs/issue14010.go
new file mode 100644
index 0000000..f5cab41
--- /dev/null
+++ b/test/fixedbugs/issue14010.go
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2016 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.
+
+// Verify that built-in types don't get printed with
+// (empty) package qualification.
+
+package main
+
+func main() {
+ true = false // ERROR "cannot assign to true"
+ byte = 0 // ERROR "not an expression" "cannot assign to byte"
+}
diff --git a/test/fixedbugs/issue14136.go b/test/fixedbugs/issue14136.go
new file mode 100644
index 0000000..928a60b
--- /dev/null
+++ b/test/fixedbugs/issue14136.go
@@ -0,0 +1,19 @@
+// errorcheck
+
+// Copyright 2016 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.
+
+// Test that > 10 non-syntax errors on the same line
+// don't lead to early exit. Specifically, here test
+// that we see the initialization error for variable
+// s.
+
+package main
+
+type T struct{}
+
+func main() {
+ t := T{X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1, X: 1} // ERROR "unknown T field"
+ var s string = 1 // ERROR "cannot use 1"
+}
diff --git a/test/fixedbugs/issue14164.dir/a.go b/test/fixedbugs/issue14164.dir/a.go
new file mode 100644
index 0000000..bf03051
--- /dev/null
+++ b/test/fixedbugs/issue14164.dir/a.go
@@ -0,0 +1,47 @@
+// Copyright 2016 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
+
+// F is an exported function, small enough to be inlined.
+// It defines a local interface with an unexported method
+// f, which will appear with a package-qualified method
+// name in the export data.
+func F(x interface{}) bool {
+ _, ok := x.(interface {
+ f()
+ })
+ return ok
+}
+
+// Like F but with the unexported interface method f
+// defined via an embedded interface t. The compiler
+// always flattens embedded interfaces so there should
+// be no difference between F and G. Alas, currently
+// G is not inlineable (at least via export data), so
+// the issue is moot, here.
+func G(x interface{}) bool {
+ type t0 interface {
+ f()
+ }
+ _, ok := x.(interface {
+ t0
+ })
+ return ok
+}
+
+// Like G but now the embedded interface is declared
+// at package level. This function is inlineable via
+// export data. The export data representation is like
+// for F.
+func H(x interface{}) bool {
+ _, ok := x.(interface {
+ t1
+ })
+ return ok
+}
+
+type t1 interface {
+ f()
+}
diff --git a/test/fixedbugs/issue14164.dir/main.go b/test/fixedbugs/issue14164.dir/main.go
new file mode 100644
index 0000000..bcc6a63
--- /dev/null
+++ b/test/fixedbugs/issue14164.dir/main.go
@@ -0,0 +1,12 @@
+// Copyright 2016 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 main
+
+// Verify that we can import package "a" containing an inlineable
+// function F that declares a local interface with a non-exported
+// method f.
+import _ "./a"
+
+func main() {}
diff --git a/test/fixedbugs/issue14164.go b/test/fixedbugs/issue14164.go
new file mode 100644
index 0000000..5247599
--- /dev/null
+++ b/test/fixedbugs/issue14164.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2016 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.
+
+ignored
diff --git a/test/fixedbugs/issue14331.dir/a.go b/test/fixedbugs/issue14331.dir/a.go
new file mode 100644
index 0000000..f1e57ef
--- /dev/null
+++ b/test/fixedbugs/issue14331.dir/a.go
@@ -0,0 +1,14 @@
+// Copyright 2016 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
+
+var S struct {
+ Str string `tag`
+}
+
+func F() string {
+ v := S
+ return v.Str
+}
diff --git a/test/fixedbugs/issue14331.dir/b.go b/test/fixedbugs/issue14331.dir/b.go
new file mode 100644
index 0000000..a2280a3
--- /dev/null
+++ b/test/fixedbugs/issue14331.dir/b.go
@@ -0,0 +1,11 @@
+// Copyright 2016 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"
+
+func G() string {
+ return a.F()
+}
diff --git a/test/fixedbugs/issue14331.go b/test/fixedbugs/issue14331.go
new file mode 100644
index 0000000..b8ee2fb
--- /dev/null
+++ b/test/fixedbugs/issue14331.go
@@ -0,0 +1,9 @@
+// compiledir
+
+// Copyright 2016 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.
+
+// Inline function misses struct tags.
+
+package ignored
diff --git a/test/fixedbugs/issue14405.go b/test/fixedbugs/issue14405.go
new file mode 100644
index 0000000..94592fd
--- /dev/null
+++ b/test/fixedbugs/issue14405.go
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2016 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.
+
+// Mention of field with large offset in struct literal causes crash
+package p
+
+type T struct {
+ Slice [1 << 20][]int
+ Ptr *int
+}
+
+func New(p *int) *T {
+ return &T{Ptr: p}
+}
diff --git a/test/fixedbugs/issue14520.go b/test/fixedbugs/issue14520.go
new file mode 100644
index 0000000..1b1f4de
--- /dev/null
+++ b/test/fixedbugs/issue14520.go
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2016 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 f
+
+import /* // ERROR "import path" */ `
+bogus`
+
+func f(x int /* // ERROR "unexpected semicolon"
+
+*/)
diff --git a/test/fixedbugs/issue14553.go b/test/fixedbugs/issue14553.go
new file mode 100644
index 0000000..d7ebb12
--- /dev/null
+++ b/test/fixedbugs/issue14553.go
@@ -0,0 +1,45 @@
+// run
+
+// Copyright 2016 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.
+
+// This test checks if the compiler's internal constant
+// arithmetic correctly rounds denormal float32 values.
+
+package main
+
+import (
+ "fmt"
+ "math"
+)
+
+func main() {
+ for _, t := range []struct {
+ value float32
+ bits uint32
+ }{
+ {0e+00, 0x00000000},
+ {1e-46, 0x00000000},
+ {0.5e-45, 0x00000000},
+ {0.8e-45, 0x00000001},
+ {1e-45, 0x00000001},
+ {2e-45, 0x00000001},
+ {3e-45, 0x00000002},
+ {4e-45, 0x00000003},
+ {5e-45, 0x00000004},
+ {6e-45, 0x00000004},
+ {7e-45, 0x00000005},
+ {8e-45, 0x00000006},
+ {9e-45, 0x00000006},
+ {1.0e-44, 0x00000007},
+ {1.1e-44, 0x00000008},
+ {1.2e-44, 0x00000009},
+ } {
+ got := math.Float32bits(t.value)
+ want := t.bits
+ if got != want {
+ panic(fmt.Sprintf("bits(%g) = 0x%08x; want 0x%08x", t.value, got, want))
+ }
+ }
+}
diff --git a/test/fixedbugs/issue14591.go b/test/fixedbugs/issue14591.go
new file mode 100644
index 0000000..626fbbc
--- /dev/null
+++ b/test/fixedbugs/issue14591.go
@@ -0,0 +1,38 @@
+// run
+
+// Copyright 2016 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.
+
+// Test to make sure we don't think values are dead
+// when they are assigned to a PPARAMOUT slot before
+// the last GC safepoint.
+
+package main
+
+import (
+ "fmt"
+ "runtime"
+)
+
+// When a T is deallocated, T[1] is certain to
+// get clobbered (the runtime writes 0xdeaddeaddeaddead there).
+type T [4]int
+
+func f() (r, s *T) {
+ r = &T{0x30, 0x31, 0x32, 0x33}
+ runtime.GC()
+ s = &T{0x40, 0x41, 0x42, 0x43}
+ runtime.GC()
+ return
+}
+
+func main() {
+ r, s := f()
+ if r[1] != 0x31 {
+ fmt.Printf("bad r[1], want 0x31 got %x\n", r[1])
+ }
+ if s[1] != 0x41 {
+ fmt.Printf("bad s[1], want 0x41 got %x\n", s[1])
+ }
+}
diff --git a/test/fixedbugs/issue14636.go b/test/fixedbugs/issue14636.go
new file mode 100644
index 0000000..7d1b606
--- /dev/null
+++ b/test/fixedbugs/issue14636.go
@@ -0,0 +1,43 @@
+// +build !nacl,!android,!darwin darwin,!arm
+// run
+
+// Copyright 2016 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 main
+
+import (
+ "bytes"
+ "log"
+ "os/exec"
+ "strings"
+)
+
+func main() {
+ checkLinkOutput("", "-B argument must start with 0x")
+ checkLinkOutput("0", "-B argument must start with 0x")
+ checkLinkOutput("0x", "usage")
+ checkLinkOutput("0x0", "-B argument must have even number of digits")
+ checkLinkOutput("0x00", "usage")
+ checkLinkOutput("0xYZ", "-B argument contains invalid hex digit")
+ checkLinkOutput("0x"+strings.Repeat("00", 32), "usage")
+ checkLinkOutput("0x"+strings.Repeat("00", 33), "-B option too long (max 32 digits)")
+}
+
+func checkLinkOutput(buildid string, message string) {
+ cmd := exec.Command("go", "tool", "link", "-B", buildid)
+ out, err := cmd.CombinedOutput()
+ if err == nil {
+ log.Fatalf("expected cmd/link to fail")
+ }
+
+ firstLine := string(bytes.SplitN(out, []byte("\n"), 2)[0])
+ if strings.HasPrefix(firstLine, "panic") {
+ log.Fatalf("cmd/link panicked:\n%s", out)
+ }
+
+ if !strings.Contains(firstLine, message) {
+ log.Fatalf("cmd/link output did not include expected message %q: %s", message, firstLine)
+ }
+}
diff --git a/test/fixedbugs/issue14646.go b/test/fixedbugs/issue14646.go
new file mode 100644
index 0000000..96a6854
--- /dev/null
+++ b/test/fixedbugs/issue14646.go
@@ -0,0 +1,23 @@
+// run
+
+// Copyright 2016 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 main
+
+import "runtime"
+
+func main() {
+ var file string
+ var line int
+ func() {
+ defer func() {
+ _, file, line, _ = runtime.Caller(1)
+ }()
+ }() // this is the expected line
+ const EXPECTED = 18
+ if line != EXPECTED {
+ println("Expected line =", EXPECTED, "but got line =", line, "and file =", file)
+ }
+}
diff --git a/test/fixedbugs/issue14651.go b/test/fixedbugs/issue14651.go
new file mode 100644
index 0000000..4c756e5
--- /dev/null
+++ b/test/fixedbugs/issue14651.go
@@ -0,0 +1,71 @@
+// run
+
+// Copyright 2016 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.
+
+// This test checks if the compiler's internal constant
+// arithmetic correctly rounds up floating-point values
+// that become the smallest denormal value.
+//
+// See also related issue 14553 and test issue14553.go.
+
+package main
+
+import (
+ "fmt"
+ "math"
+)
+
+const (
+ p149 = 1.0 / (1 << 149) // 1p-149
+ p500 = 1.0 / (1 << 500) // 1p-500
+ p1074 = p500 * p500 / (1<<74) // 1p-1074
+)
+
+const (
+ m0000p149 = 0x0 / 16.0 * p149 // = 0.0000p-149
+ m1000p149 = 0x8 / 16.0 * p149 // = 0.1000p-149
+ m1001p149 = 0x9 / 16.0 * p149 // = 0.1001p-149
+ m1011p149 = 0xb / 16.0 * p149 // = 0.1011p-149
+ m1100p149 = 0xc / 16.0 * p149 // = 0.1100p-149
+
+ m0000p1074 = 0x0 / 16.0 * p1074 // = 0.0000p-1074
+ m1000p1074 = 0x8 / 16.0 * p1074 // = 0.1000p-1074
+ m1001p1074 = 0x9 / 16.0 * p1074 // = 0.1001p-1074
+ m1011p1074 = 0xb / 16.0 * p1074 // = 0.1011p-1074
+ m1100p1074 = 0xc / 16.0 * p1074 // = 0.1100p-1074
+)
+
+func main() {
+ test32(float32(m0000p149), f32(m0000p149))
+ test32(float32(m1000p149), f32(m1000p149))
+ test32(float32(m1001p149), f32(m1001p149))
+ test32(float32(m1011p149), f32(m1011p149))
+ test32(float32(m1100p149), f32(m1100p149))
+
+ test64(float64(m0000p1074), f64(m0000p1074))
+ test64(float64(m1000p1074), f64(m1000p1074))
+ test64(float64(m1001p1074), f64(m1001p1074))
+ test64(float64(m1011p1074), f64(m1011p1074))
+ test64(float64(m1100p1074), f64(m1100p1074))
+}
+
+func f32(x float64) float32 { return float32(x) }
+func f64(x float64) float64 { return float64(x) }
+
+func test32(a, b float32) {
+ abits := math.Float32bits(a)
+ bbits := math.Float32bits(b)
+ if abits != bbits {
+ panic(fmt.Sprintf("%08x != %08x\n", abits, bbits))
+ }
+}
+
+func test64(a, b float64) {
+ abits := math.Float64bits(a)
+ bbits := math.Float64bits(b)
+ if abits != bbits {
+ panic(fmt.Sprintf("%016x != %016x\n", abits, bbits))
+ }
+}
diff --git a/test/fixedbugs/issue14652.go b/test/fixedbugs/issue14652.go
new file mode 100644
index 0000000..b030aee
--- /dev/null
+++ b/test/fixedbugs/issue14652.go
@@ -0,0 +1,9 @@
+// errorcheck
+
+// Copyright 2016 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 p
+
+var x any // ERROR "undefined: any"
diff --git a/test/fixedbugs/issue14725.go b/test/fixedbugs/issue14725.go
new file mode 100644
index 0000000..49f3fbc
--- /dev/null
+++ b/test/fixedbugs/issue14725.go
@@ -0,0 +1,57 @@
+// run
+
+// Copyright 2016 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 main
+
+import "fmt"
+
+func f1() (x int) {
+ for {
+ defer func() {
+ recover()
+ x = 1
+ }()
+ panic(nil)
+ }
+}
+
+var sink *int
+
+func f2() (x int) {
+ sink = &x
+ defer func() {
+ recover()
+ x = 1
+ }()
+ panic(nil)
+}
+
+func f3(b bool) (x int) {
+ sink = &x
+ defer func() {
+ recover()
+ x = 1
+ }()
+ if b {
+ panic(nil)
+ }
+ return
+}
+
+func main() {
+ if x := f1(); x != 1 {
+ panic(fmt.Sprintf("f1 returned %d, wanted 1", x))
+ }
+ if x := f2(); x != 1 {
+ panic(fmt.Sprintf("f2 returned %d, wanted 1", x))
+ }
+ if x := f3(true); x != 1 {
+ panic(fmt.Sprintf("f3(true) returned %d, wanted 1", x))
+ }
+ if x := f3(false); x != 1 {
+ panic(fmt.Sprintf("f3(false) returned %d, wanted 1", x))
+ }
+}
diff --git a/test/fixedbugs/issue14729.go b/test/fixedbugs/issue14729.go
new file mode 100644
index 0000000..88e01f9
--- /dev/null
+++ b/test/fixedbugs/issue14729.go
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2016 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 14729: structs cannot embed unsafe.Pointer per the spec.
+
+package main
+
+import "unsafe"
+
+type s struct { unsafe.Pointer } // ERROR "embedded type cannot be a pointer"
+type s1 struct { p unsafe.Pointer }
diff --git a/test/fixedbugs/issue14988.go b/test/fixedbugs/issue14988.go
new file mode 100644
index 0000000..4ddc7e7
--- /dev/null
+++ b/test/fixedbugs/issue14988.go
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2016 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 14988: defining a map with an invalid forward declaration array
+// key doesn't cause a fatal.
+
+package main
+
+type m map[k]int // ERROR "invalid map key type"
+type k [1]m
diff --git a/test/fixedbugs/issue14999.go b/test/fixedbugs/issue14999.go
new file mode 100644
index 0000000..6ce768e
--- /dev/null
+++ b/test/fixedbugs/issue14999.go
@@ -0,0 +1,18 @@
+// errorcheck -+
+
+// Copyright 2016 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 p
+
+func f(x int) func(int) int {
+ return func(y int) int { return x + y } // ERROR "heap-allocated closure, not allowed in runtime."
+}
+
+func g(x int) func(int) int { // ERROR "x escapes to heap, not allowed in runtime."
+ return func(y int) int { // ERROR "heap-allocated closure, not allowed in runtime."
+ x += y
+ return x + y
+ }
+}
diff --git a/test/fixedbugs/issue15002.go b/test/fixedbugs/issue15002.go
new file mode 100644
index 0000000..a27fd92
--- /dev/null
+++ b/test/fixedbugs/issue15002.go
@@ -0,0 +1,132 @@
+// run
+// +build amd64
+// +build linux darwin
+
+// Copyright 2016 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 main
+
+import (
+ "fmt"
+ "syscall"
+)
+
+// Use global variables so the compiler
+// doesn't know that they are constants.
+var p = syscall.Getpagesize()
+var zero = 0
+var one = 1
+
+func main() {
+ // Allocate 2 pages of memory.
+ b, err := syscall.Mmap(-1, 0, 2*p, syscall.PROT_READ|syscall.PROT_WRITE, syscall.MAP_ANON|syscall.MAP_PRIVATE)
+ if err != nil {
+ panic(err)
+ }
+ // Mark the second page as faulting.
+ err = syscall.Mprotect(b[p:], syscall.PROT_NONE)
+ if err != nil {
+ panic(err)
+ }
+ // Get a slice pointing to the last byte of the good page.
+ x := b[p-one : p]
+
+ test16(x)
+ test16i(x, 0)
+ test32(x)
+ test32i(x, 0)
+ test64(x)
+ test64i(x, 0)
+}
+
+func test16(x []byte) uint16 {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("no fault or bounds check failure happened")
+ }
+ s := fmt.Sprintf("%s", r)
+ if s != "runtime error: index out of range" {
+ panic("bad panic: " + s)
+ }
+ }()
+ // Try to read 2 bytes from x.
+ return uint16(x[0]) | uint16(x[1])<<8
+
+ // We expect to get an "index out of range" error from x[1].
+ // If we promote the first load to a 2-byte load, it will segfault, which we don't want.
+}
+
+func test16i(x []byte, i int) uint16 {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("no fault or bounds check failure happened")
+ }
+ s := fmt.Sprintf("%s", r)
+ if s != "runtime error: index out of range" {
+ panic("bad panic: " + s)
+ }
+ }()
+ return uint16(x[i]) | uint16(x[i+1])<<8
+}
+
+func test32(x []byte) uint32 {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("no fault or bounds check failure happened")
+ }
+ s := fmt.Sprintf("%s", r)
+ if s != "runtime error: index out of range" {
+ panic("bad panic: " + s)
+ }
+ }()
+ return uint32(x[0]) | uint32(x[1])<<8 | uint32(x[2])<<16 | uint32(x[3])<<24
+}
+
+func test32i(x []byte, i int) uint32 {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("no fault or bounds check failure happened")
+ }
+ s := fmt.Sprintf("%s", r)
+ if s != "runtime error: index out of range" {
+ panic("bad panic: " + s)
+ }
+ }()
+ return uint32(x[i]) | uint32(x[i+1])<<8 | uint32(x[i+2])<<16 | uint32(x[i+3])<<24
+}
+
+func test64(x []byte) uint64 {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("no fault or bounds check failure happened")
+ }
+ s := fmt.Sprintf("%s", r)
+ if s != "runtime error: index out of range" {
+ panic("bad panic: " + s)
+ }
+ }()
+ return uint64(x[0]) | uint64(x[1])<<8 | uint64(x[2])<<16 | uint64(x[3])<<24 |
+ uint64(x[4])<<32 | uint64(x[5])<<40 | uint64(x[6])<<48 | uint64(x[7])<<56
+}
+
+func test64i(x []byte, i int) uint64 {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("no fault or bounds check failure happened")
+ }
+ s := fmt.Sprintf("%s", r)
+ if s != "runtime error: index out of range" {
+ panic("bad panic: " + s)
+ }
+ }()
+ return uint64(x[i+0]) | uint64(x[i+1])<<8 | uint64(x[i+2])<<16 | uint64(x[i+3])<<24 |
+ uint64(x[i+4])<<32 | uint64(x[i+5])<<40 | uint64(x[i+6])<<48 | uint64(x[i+7])<<56
+}
diff --git a/test/fixedbugs/issue15013.go b/test/fixedbugs/issue15013.go
new file mode 100644
index 0000000..9e218e6
--- /dev/null
+++ b/test/fixedbugs/issue15013.go
@@ -0,0 +1,24 @@
+// compile
+
+// Copyright 2016 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.
+
+// CL 21202 introduced a compiler crash in the handling of a varargs
+// function in the same recursive group as a function that calls it.
+// Nothing in the standard library caught the problem, so adding a test.
+
+package p
+
+func F1(p *int, a ...*int) (int, *int) {
+ if p == nil {
+ return F2(), a[0]
+ }
+ return 0, a[0]
+}
+
+func F2() int {
+ var i0, i1 int
+ a, _ := F1(&i0, &i1)
+ return a
+}
diff --git a/test/fixedbugs/issue15039.go b/test/fixedbugs/issue15039.go
new file mode 100644
index 0000000..85d9e83
--- /dev/null
+++ b/test/fixedbugs/issue15039.go
@@ -0,0 +1,25 @@
+// run
+
+// Copyright 2016 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 main
+
+func main() {
+ const fffd = "\uFFFD"
+
+ // runtime.intstring used to convert int64 to rune without checking
+ // for truncation.
+ u := uint64(0x10001f4a9)
+ big := string(u)
+ if big != fffd {
+ panic("big != bad")
+ }
+
+ // cmd/compile used to require integer constants to fit into an "int".
+ const huge = string(1<<100)
+ if huge != fffd {
+ panic("huge != bad")
+ }
+}
diff --git a/test/fixedbugs/issue15042.go b/test/fixedbugs/issue15042.go
new file mode 100644
index 0000000..85d5d6c
--- /dev/null
+++ b/test/fixedbugs/issue15042.go
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2016 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.
+
+// Exchanging two struct fields was compiled incorrectly.
+
+package main
+
+type S struct {
+ i int
+}
+
+func F(c bool, s1, s2 S) (int, int) {
+ if c {
+ s1.i, s2.i = s2.i, s1.i
+ }
+ return s1.i, s2.i
+}
+
+func main() {
+ i, j := F(true, S{1}, S{20})
+ if i != 20 || j != 1 {
+ panic(i+j)
+ }
+}
diff --git a/test/fixedbugs/issue15071.dir/exp/exp.go b/test/fixedbugs/issue15071.dir/exp/exp.go
new file mode 100644
index 0000000..e6041e6
--- /dev/null
+++ b/test/fixedbugs/issue15071.dir/exp/exp.go
@@ -0,0 +1,24 @@
+// Copyright 2016 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 exp
+
+func Exported(x int) int {
+ return inlined(x)
+}
+
+func inlined(x int) int {
+ y := 0
+ switch {
+ case x > 0:
+ y += 5
+ return 0 + y
+ case x < 1:
+ y += 6
+ fallthrough
+ default:
+ y += 7
+ return 2 + y
+ }
+}
diff --git a/test/fixedbugs/issue15071.dir/main.go b/test/fixedbugs/issue15071.dir/main.go
new file mode 100644
index 0000000..96790da
--- /dev/null
+++ b/test/fixedbugs/issue15071.dir/main.go
@@ -0,0 +1,14 @@
+// run
+
+// Copyright 2016 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 main
+
+import "os"
+import "./exp"
+
+func main() {
+ _ = exp.Exported(len(os.Args))
+}
diff --git a/test/fixedbugs/issue15084.go b/test/fixedbugs/issue15084.go
new file mode 100644
index 0000000..7eb294e
--- /dev/null
+++ b/test/fixedbugs/issue15084.go
@@ -0,0 +1,30 @@
+// compile
+
+// Copyright 2016 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 x
+
+type T struct {
+ i int
+ e interface{}
+}
+
+func (t *T) F() bool {
+ if t.i != 0 {
+ return false
+ }
+ _, ok := t.e.(string)
+ return ok
+}
+
+var x int
+
+func g(t *T) {
+ if t.F() || true {
+ if t.F() {
+ x = 0
+ }
+ }
+}
diff --git a/test/fixedbugs/issue15091.go b/test/fixedbugs/issue15091.go
new file mode 100644
index 0000000..00fb473
--- /dev/null
+++ b/test/fixedbugs/issue15091.go
@@ -0,0 +1,25 @@
+// errorcheck -0 -race
+
+// Copyright 2016 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 sample
+
+type Html struct {
+ headerIDs map[string]int
+}
+
+// We don't want to see:
+// internal error: (*Html).xyzzy autotmp_3 (type *int) recorded as live on entry, p.Pc=0
+// or (now, with the error caught earlier)
+// Treating auto as if it were arg, func (*Html).xyzzy, node ...
+// caused by racewalker inserting instrumentation before an OAS where the Ninit
+// of the OAS defines part of its right-hand-side. (I.e., the race instrumentation
+// references a variable before it is defined.)
+func (options *Html) xyzzy(id string) string {
+ for count, found := options.headerIDs[id]; found; count, found = options.headerIDs[id] {
+ _ = count
+ }
+ return ""
+}
diff --git a/test/fixedbugs/issue15175.go b/test/fixedbugs/issue15175.go
new file mode 100644
index 0000000..55a8f7d
--- /dev/null
+++ b/test/fixedbugs/issue15175.go
@@ -0,0 +1,66 @@
+// run
+
+// Copyright 2016 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.
+
+// Make sure unsigned shift results get sign-extended correctly.
+package main
+
+import "fmt"
+
+func main() {
+ failed := false
+ a6 := uint8(253)
+ if got := a6 >> 0; got != 253 {
+ fmt.Printf("uint8(253)>>0 = %v, wanted 253\n", got)
+ failed = true
+ }
+ if got := f1(0, 2, 1, 0, 0, 1, true); got != 255 {
+ fmt.Printf("f1(...) = %v, wanted 255\n", got)
+ failed = true
+ }
+ if got := f2(1); got != 242 {
+ fmt.Printf("f2(...) = %v, wanted 242\n", got)
+ failed = true
+ }
+ if got := f3(false, 0, 0); got != 254 {
+ fmt.Printf("f3(...) = %v, wanted 254\n", got)
+ failed = true
+ }
+ if failed {
+ panic("bad")
+ }
+}
+
+func f1(a1 uint, a2 int8, a3 int8, a4 int8, a5 uint8, a6 int, a7 bool) uint8 {
+ a5--
+ a4 += (a2 << a1 << 2) | (a4 ^ a4<<(a1&a1)) - a3 // int8
+ a6 -= a6 >> (2 + uint32(a2)>>3) // int
+ a1 += a1 // uint
+ a3 *= a4 << (a1 | a1) << (uint16(3) >> 2 & (1 - 0) & (uint16(1) << a5 << 3)) // int8
+ a7 = a7 || ((a2 == a4) || (a7 && a7) || ((a5 == a5) || (a7 || a7))) // bool
+ return a5 >> a1
+}
+
+func f2(a1 uint8) uint8 {
+ a1--
+ a1--
+ a1 -= a1 + (a1 << 1) - (a1*a1*a1)<<(2-0+(3|3)-1) // uint8
+ v1 := 0 * ((2 * 1) ^ 1) & ((uint(0) >> a1) + (2+0)*(uint(2)+0)) // uint
+ _ = v1
+ return a1 >> (((2 ^ 2) >> (v1 | 2)) + 0)
+}
+
+func f3(a1 bool, a2 uint, a3 int64) uint8 {
+ a3--
+ v1 := 1 & (2 & 1 * (1 ^ 2) & (uint8(3*1) >> 0)) // uint8
+ _ = v1
+ v1 += v1 - (v1 >> a2) + (v1 << (a2 ^ a2) & v1) // uint8
+ v1 *= v1 // uint8
+ a3--
+ v1 += v1 & v1 // uint8
+ v1--
+ v1 = ((v1 << 0) | v1>>0) + v1 // uint8
+ return v1 >> 0
+}
diff --git a/test/fixedbugs/issue15252.go b/test/fixedbugs/issue15252.go
new file mode 100644
index 0000000..370a885
--- /dev/null
+++ b/test/fixedbugs/issue15252.go
@@ -0,0 +1,32 @@
+// run
+
+// Copyright 2016 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.
+
+// This test makes sure that we use all 64 bits of an
+// index, even on 32 bit machines. It also tests that nacl
+// can compile 64 bit indexes loaded from ODOTPTR properly.
+
+package main
+
+type T struct {
+ i int64
+}
+
+func f(t *T) byte {
+ b := [2]byte{3, 4}
+ return b[t.i]
+}
+
+func main() {
+ t := &T{0x100000001}
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("panic wasn't recoverable")
+ }
+ }()
+ f(t)
+ panic("index didn't panic")
+}
diff --git a/test/fixedbugs/issue15277.go b/test/fixedbugs/issue15277.go
new file mode 100644
index 0000000..719c9a4
--- /dev/null
+++ b/test/fixedbugs/issue15277.go
@@ -0,0 +1,38 @@
+// run
+
+// Copyright 2016 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.
+// +build amd64
+
+package main
+
+import "runtime"
+
+type big [10 << 20]byte
+
+func f(x *big, start int64) {
+ if delta := inuse() - start; delta < 9<<20 {
+ println("after alloc: expected delta at least 9MB, got: ", delta)
+ }
+ x = nil
+ if delta := inuse() - start; delta > 1<<20 {
+ println("after drop: expected delta below 1MB, got: ", delta)
+ }
+ x = new(big)
+ if delta := inuse() - start; delta < 9<<20 {
+ println("second alloc: expected delta at least 9MB, got: ", delta)
+ }
+}
+
+func main() {
+ x := inuse()
+ f(new(big), x)
+}
+
+func inuse() int64 {
+ runtime.GC()
+ var st runtime.MemStats
+ runtime.ReadMemStats(&st)
+ return int64(st.Alloc)
+}
diff --git a/test/fixedbugs/issue15281.go b/test/fixedbugs/issue15281.go
new file mode 100644
index 0000000..187c96f
--- /dev/null
+++ b/test/fixedbugs/issue15281.go
@@ -0,0 +1,64 @@
+// run
+
+// Copyright 2016 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 main
+
+import "runtime"
+
+func main() {
+ {
+ x := inuse()
+ c := make(chan []byte, 10)
+ c <- make([]byte, 10<<20)
+ close(c)
+ f1(c, x)
+ }
+ {
+ x := inuse()
+ c := make(chan []byte, 10)
+ c <- make([]byte, 10<<20)
+ close(c)
+ f2(c, x)
+ }
+}
+
+func f1(c chan []byte, start int64) {
+ for x := range c {
+ if delta := inuse() - start; delta < 9<<20 {
+ println("BUG: f1: after alloc: expected delta at least 9MB, got: ", delta)
+ println(x)
+ }
+ x = nil
+ if delta := inuse() - start; delta > 1<<20 {
+ println("BUG: f1: after alloc: expected delta below 1MB, got: ", delta)
+ println(x)
+ }
+ }
+}
+
+func f2(c chan []byte, start int64) {
+ for {
+ x, ok := <-c
+ if !ok {
+ break
+ }
+ if delta := inuse() - start; delta < 9<<20 {
+ println("BUG: f2: after alloc: expected delta at least 9MB, got: ", delta)
+ println(x)
+ }
+ x = nil
+ if delta := inuse() - start; delta > 1<<20 {
+ println("BUG: f2: after alloc: expected delta below 1MB, got: ", delta)
+ println(x)
+ }
+ }
+}
+
+func inuse() int64 {
+ runtime.GC()
+ var st runtime.MemStats
+ runtime.ReadMemStats(&st)
+ return int64(st.Alloc)
+}
diff --git a/test/fixedbugs/issue15311.go b/test/fixedbugs/issue15311.go
new file mode 100644
index 0000000..81fa541
--- /dev/null
+++ b/test/fixedbugs/issue15311.go
@@ -0,0 +1,20 @@
+// errorcheck
+
+// Copyright 2016 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.
+
+// The compiler was failing to correctly report an error when a dot
+// expression was used a struct literal key.
+
+package p
+
+type T struct {
+ toInt map[string]int
+ toString map[int]string
+}
+
+var t = T{
+ foo.toInt: make(map[string]int), // ERROR "field name"
+ bar.toString: make(map[int]string), // ERROR "field name"
+}
diff --git a/test/fixedbugs/issue15329.go b/test/fixedbugs/issue15329.go
new file mode 100644
index 0000000..30fbf13
--- /dev/null
+++ b/test/fixedbugs/issue15329.go
@@ -0,0 +1,79 @@
+// run
+
+// Copyright 2016 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.
+
+// Previously, cmd/compile would rewrite
+//
+// check(unsafe.Pointer(testMeth(1).Pointer()), unsafe.Pointer(testMeth(2).Pointer()))
+//
+// to
+//
+// var autotmp_1 uintptr = testMeth(1).Pointer()
+// var autotmp_2 uintptr = testMeth(2).Pointer()
+// check(unsafe.Pointer(autotmp_1), unsafe.Pointer(autotmp_2))
+//
+// However, that means autotmp_1 is the only reference to the int
+// variable containing the value "1", but it's not a pointer type,
+// so it was at risk of being garbage collected by the evaluation of
+// testMeth(2).Pointer(), even though package unsafe's documentation
+// says the original code was allowed.
+//
+// Now cmd/compile rewrites it to
+//
+// var autotmp_1 unsafe.Pointer = unsafe.Pointer(testMeth(1).Pointer())
+// var autotmp_2 unsafe.Pointer = unsafe.Pointer(testMeth(2).Pointer())
+// check(autotmp_1, autotmp_2)
+//
+// to ensure the pointed-to variables are visible to the GC.
+
+package main
+
+import (
+ "fmt"
+ "reflect"
+ "runtime"
+ "unsafe"
+)
+
+func main() {
+ // Test all the different ways we can invoke reflect.Value.Pointer.
+
+ // Direct method invocation.
+ check(unsafe.Pointer(testMeth(1).Pointer()), unsafe.Pointer(testMeth(2).Pointer()))
+
+ // Invocation via method expression.
+ check(unsafe.Pointer(reflect.Value.Pointer(testMeth(1))), unsafe.Pointer(reflect.Value.Pointer(testMeth(2))))
+
+ // Invocation via interface.
+ check(unsafe.Pointer(testInter(1).Pointer()), unsafe.Pointer(testInter(2).Pointer()))
+
+ // Invocation via method value.
+ check(unsafe.Pointer(testFunc(1)()), unsafe.Pointer(testFunc(2)()))
+}
+
+func check(p, q unsafe.Pointer) {
+ a, b := *(*int)(p), *(*int)(q)
+ if a != 1 || b != 2 {
+ fmt.Printf("got %v, %v; expected 1, 2\n", a, b)
+ }
+}
+
+func testMeth(x int) reflect.Value {
+ // Force GC to run.
+ runtime.GC()
+ return reflect.ValueOf(&x)
+}
+
+type Pointerer interface {
+ Pointer() uintptr
+}
+
+func testInter(x int) Pointerer {
+ return testMeth(x)
+}
+
+func testFunc(x int) func() uintptr {
+ return testMeth(x).Pointer
+}
diff --git a/test/fixedbugs/issue15439.go b/test/fixedbugs/issue15439.go
new file mode 100644
index 0000000..840a3c0
--- /dev/null
+++ b/test/fixedbugs/issue15439.go
@@ -0,0 +1,25 @@
+// run
+
+// Copyright 2016 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 main
+
+import "reflect"
+
+func main() {
+ a := &struct{ x int }{}
+ b := &struct{ x int "" }{}
+
+ ta := reflect.TypeOf(a)
+ tb := reflect.TypeOf(b)
+
+ // Ensure cmd/compile treats absent and empty tags as equivalent.
+ a = b
+
+ // Ensure package reflect treats absent and empty tags as equivalent.
+ if !tb.AssignableTo(ta) {
+ panic("fail")
+ }
+}
diff --git a/test/fixedbugs/issue15470.dir/a.go b/test/fixedbugs/issue15470.dir/a.go
new file mode 100644
index 0000000..1fcf3ea
--- /dev/null
+++ b/test/fixedbugs/issue15470.dir/a.go
@@ -0,0 +1,24 @@
+package a
+
+import "io"
+
+type T interface {
+ M0(_ int)
+ M1(x, _ int) // _ (blank) caused crash
+ M2() (x, _ int)
+}
+
+type S struct{}
+
+func (S) M0(_ int) {}
+func (S) M1(x, _ int) {}
+func (S) M2() (x, _ int) { return }
+func (_ S) M3() {}
+
+// Snippet from x/tools/godoc/analysis/analysis.go.
+// Offending code from #5470.
+type Link interface {
+ Start() int
+ End() int
+ Write(w io.Writer, _ int, start bool) // _ (blank) caused crash
+}
diff --git a/test/fixedbugs/issue15470.dir/b.go b/test/fixedbugs/issue15470.dir/b.go
new file mode 100644
index 0000000..863ee9f
--- /dev/null
+++ b/test/fixedbugs/issue15470.dir/b.go
@@ -0,0 +1,3 @@
+package b
+
+import _ "./a" // must not fail
diff --git a/test/fixedbugs/issue15470.go b/test/fixedbugs/issue15470.go
new file mode 100644
index 0000000..22b48fe
--- /dev/null
+++ b/test/fixedbugs/issue15470.go
@@ -0,0 +1,10 @@
+// compiledir
+
+// Copyright 2016 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 15470: Make sure special-case signatures can
+// be exported and imported w/o problems.
+
+package ignored
diff --git a/test/fixedbugs/issue15548.dir/a.go b/test/fixedbugs/issue15548.dir/a.go
new file mode 100644
index 0000000..3c593fc
--- /dev/null
+++ b/test/fixedbugs/issue15548.dir/a.go
@@ -0,0 +1,17 @@
+// Copyright 2016 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
+
+type I0 interface {
+ I1
+}
+
+type T struct {
+ I1
+}
+
+type I1 interface {
+ M(*T) // removing * makes crash go away
+}
diff --git a/test/fixedbugs/issue15548.dir/b.go b/test/fixedbugs/issue15548.dir/b.go
new file mode 100644
index 0000000..b46f5ad
--- /dev/null
+++ b/test/fixedbugs/issue15548.dir/b.go
@@ -0,0 +1,9 @@
+// Copyright 2016 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 X a.T
diff --git a/test/fixedbugs/issue15548.dir/c.go b/test/fixedbugs/issue15548.dir/c.go
new file mode 100644
index 0000000..6d3f3be
--- /dev/null
+++ b/test/fixedbugs/issue15548.dir/c.go
@@ -0,0 +1,10 @@
+// Copyright 2016 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 c
+
+import (
+ _ "./b"
+ _ "./a"
+)
diff --git a/test/fixedbugs/issue15548.go b/test/fixedbugs/issue15548.go
new file mode 100644
index 0000000..4d2844d
--- /dev/null
+++ b/test/fixedbugs/issue15548.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2016 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 ignored
diff --git a/test/fixedbugs/issue15572.dir/a.go b/test/fixedbugs/issue15572.dir/a.go
new file mode 100644
index 0000000..1356601
--- /dev/null
+++ b/test/fixedbugs/issue15572.dir/a.go
@@ -0,0 +1,40 @@
+// Copyright 2016 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
+
+type T struct {
+}
+
+func F() []T {
+ return []T{T{}}
+}
+
+func Fi() []T {
+ return []T{{}} // element with implicit composite literal type
+}
+
+func Fp() []*T {
+ return []*T{&T{}}
+}
+
+func Fip() []*T {
+ return []*T{{}} // element with implicit composite literal type
+}
+
+func Gp() map[int]*T {
+ return map[int]*T{0: &T{}}
+}
+
+func Gip() map[int]*T {
+ return map[int]*T{0: {}} // element with implicit composite literal type
+}
+
+func Hp() map[*T]int {
+ return map[*T]int{&T{}: 0}
+}
+
+func Hip() map[*T]int {
+ return map[*T]int{{}: 0} // key with implicit composite literal type
+}
diff --git a/test/fixedbugs/issue15572.dir/b.go b/test/fixedbugs/issue15572.dir/b.go
new file mode 100644
index 0000000..355accc
--- /dev/null
+++ b/test/fixedbugs/issue15572.dir/b.go
@@ -0,0 +1,27 @@
+// Copyright 2016 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"
+
+func F() {
+ a.F()
+ a.Fi()
+}
+
+func Fp() {
+ a.Fp()
+ a.Fip()
+}
+
+func Gp() {
+ a.Gp()
+ a.Gip()
+}
+
+func Hp() {
+ a.Hp()
+ a.Hip()
+}
diff --git a/test/fixedbugs/issue15572.go b/test/fixedbugs/issue15572.go
new file mode 100644
index 0000000..cf77778
--- /dev/null
+++ b/test/fixedbugs/issue15572.go
@@ -0,0 +1,11 @@
+// compiledir
+
+// Copyright 2016 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.
+
+// Test that exporting composite literals with implicit
+// types doesn't crash the typechecker when running over
+// inlined function bodies containing such literals.
+
+package ignored
diff --git a/test/fixedbugs/issue15585.go b/test/fixedbugs/issue15585.go
new file mode 100644
index 0000000..79eb13f
--- /dev/null
+++ b/test/fixedbugs/issue15585.go
@@ -0,0 +1,45 @@
+// compile
+
+// Copyright 2016 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 bug
+
+func example(n int) (rc int) {
+ var cc, ll, pp, rr [27]int
+ for q0 := 0; q0 < n-2; q0++ {
+ for q1 := q0 + 2; q1 < n; q1++ {
+ var c, d, l, p, r int
+ b0 := 1 << uint(q0)
+ b1 := 1 << uint(q1)
+ l = ((b0 << 1) | b1) << 1
+ c = b0 | b1 | (-1 << uint(n))
+ r = ((b0 >> 1) | b1) >> 1
+ E:
+ if c != -1 {
+ p = ^(l | c | r)
+ } else {
+ rc++
+ goto R
+ }
+ L:
+ if p != 0 {
+ lsb := p & -p
+ p &^= lsb
+ ll[d], cc[d], rr[d], pp[d] = l, c, r, p
+ l, c, r = (l|lsb)<<1, c|lsb, (r|lsb)>>1
+ d++
+ goto E
+ }
+ R:
+ d--
+ if d >= 0 {
+ l, c, r, p = ll[d], cc[d], rr[d], pp[d]
+ goto L
+ }
+ }
+ }
+ rc <<= 1
+ return
+}
diff --git a/test/fixedbugs/issue15602.go b/test/fixedbugs/issue15602.go
new file mode 100644
index 0000000..badf813
--- /dev/null
+++ b/test/fixedbugs/issue15602.go
@@ -0,0 +1,11 @@
+// compile
+
+// Copyright 2016 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 p
+
+func f(i interface{}) {
+ i, _ = i.(error)
+}
diff --git a/test/fixedbugs/issue15604.go b/test/fixedbugs/issue15604.go
new file mode 100644
index 0000000..4dc0b0b
--- /dev/null
+++ b/test/fixedbugs/issue15604.go
@@ -0,0 +1,17 @@
+// compile
+
+// Copyright 2016 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 bug
+
+import "os"
+
+func f(err error) {
+ var ok bool
+ if err, ok = err.(*os.PathError); ok {
+ if err == os.ErrNotExist {
+ }
+ }
+}
diff --git a/test/fixedbugs/issue15646.dir/a.go b/test/fixedbugs/issue15646.dir/a.go
new file mode 100644
index 0000000..842f196
--- /dev/null
+++ b/test/fixedbugs/issue15646.dir/a.go
@@ -0,0 +1,23 @@
+// Copyright 2016 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
+
+type T struct{}
+
+func (T) m() string {
+ return "m"
+}
+
+func (*T) mp() string {
+ return "mp"
+}
+
+func F() func(T) string {
+ return T.m // method expression
+}
+
+func Fp() func(*T) string {
+ return (*T).mp // method expression
+}
diff --git a/test/fixedbugs/issue15646.dir/b.go b/test/fixedbugs/issue15646.dir/b.go
new file mode 100644
index 0000000..3d011ba
--- /dev/null
+++ b/test/fixedbugs/issue15646.dir/b.go
@@ -0,0 +1,16 @@
+// Copyright 2016 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 main
+
+import "./a" // import must succeed
+
+func main() {
+ if a.F()(a.T{}) != "m" {
+ panic(0)
+ }
+ if a.Fp()(nil) != "mp" {
+ panic(1)
+ }
+}
diff --git a/test/fixedbugs/issue15646.go b/test/fixedbugs/issue15646.go
new file mode 100644
index 0000000..cd4ba9d
--- /dev/null
+++ b/test/fixedbugs/issue15646.go
@@ -0,0 +1,9 @@
+// rundir
+
+// Copyright 2016 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.
+
+// Test that method expressions are correctly encoded
+// in binary export data and can be imported again.
+package ignore
\ No newline at end of file
diff --git a/test/fixedbugs/issue15733.go b/test/fixedbugs/issue15733.go
new file mode 100644
index 0000000..8f609e6
--- /dev/null
+++ b/test/fixedbugs/issue15733.go
@@ -0,0 +1,23 @@
+// compile
+
+// Copyright 2016 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 main
+
+type S struct {
+ a [1 << 16]byte
+}
+
+func f1() {
+ p := &S{}
+ _ = p
+}
+
+type T [1 << 16]byte
+
+func f2() {
+ p := &T{}
+ _ = p
+}
diff --git a/test/fixedbugs/issue15747.go b/test/fixedbugs/issue15747.go
new file mode 100644
index 0000000..34ec719
--- /dev/null
+++ b/test/fixedbugs/issue15747.go
@@ -0,0 +1,41 @@
+// errorcheck -0 -live
+
+// Copyright 2016 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 15747: liveness analysis was marking heap-escaped params live too much,
+// and worse was using the wrong bitmap bits to do so.
+
+package p
+
+var global *[]byte
+
+type Q struct{}
+
+type T struct{ M string }
+
+var b bool
+
+func f1(q *Q, xx []byte) interface{} { // ERROR "live at entry to f1: q xx" "live at call to newobject: q xx" "live at call to writebarrierptr: q &xx"
+ // xx was copied from the stack to the heap on the previous line:
+ // xx was live for the first two prints but then it switched to &xx
+ // being live. We should not see plain xx again.
+ if b {
+ global = &xx // ERROR "live at call to writebarrierptr: q &xx$"
+ }
+ xx, _, err := f2(xx, 5) // ERROR "live at call to newobject: q( d)? &xx( odata.ptr)?" "live at call to writebarrierptr: q (e|err.data err.type)$"
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+func f2(d []byte, n int) (odata, res []byte, e interface{}) { // ERROR "live at entry to f2: d"
+ if n > len(d) {
+ return d, nil, &T{M: "hello"} // ERROR "live at call to newobject: d"
+ }
+ res = d[:n]
+ odata = d[n:]
+ return
+}
diff --git a/test/fixedbugs/issue15747b.go b/test/fixedbugs/issue15747b.go
new file mode 100644
index 0000000..9620d3d
--- /dev/null
+++ b/test/fixedbugs/issue15747b.go
@@ -0,0 +1,19 @@
+// compile
+
+// Copyright 2016 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 15747: If a ODCL is dropped, for example when inlining,
+// then it's easy to end up not initializing the '&x' pseudo-variable
+// to point to an actual allocation. The liveness analysis will detect
+// this and abort the computation, so this test just checks that the
+// compilation succeeds.
+
+package p
+
+type R [100]byte
+
+func (x R) New() *R {
+ return &x
+}
diff --git a/test/fixedbugs/issue15838.dir/a.go b/test/fixedbugs/issue15838.dir/a.go
new file mode 100644
index 0000000..15b7f1d
--- /dev/null
+++ b/test/fixedbugs/issue15838.dir/a.go
@@ -0,0 +1,61 @@
+// Copyright 2016 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 F1() {
+L:
+ goto L
+}
+
+func F2() {
+L:
+ for {
+ break L
+ }
+}
+
+func F3() {
+L:
+ for {
+ continue L
+ }
+}
+
+func F4() {
+ switch {
+ case true:
+ fallthrough
+ default:
+ }
+}
+
+type T struct{}
+
+func (T) M1() {
+L:
+ goto L
+}
+
+func (T) M2() {
+L:
+ for {
+ break L
+ }
+}
+
+func (T) M3() {
+L:
+ for {
+ continue L
+ }
+}
+
+func (T) M4() {
+ switch {
+ case true:
+ fallthrough
+ default:
+ }
+}
diff --git a/test/fixedbugs/issue15838.dir/b.go b/test/fixedbugs/issue15838.dir/b.go
new file mode 100644
index 0000000..9fd6efc
--- /dev/null
+++ b/test/fixedbugs/issue15838.dir/b.go
@@ -0,0 +1,9 @@
+// Copyright 2016 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"
+
+type T struct{ a.T }
diff --git a/test/fixedbugs/issue15838.go b/test/fixedbugs/issue15838.go
new file mode 100644
index 0000000..fb1c64d
--- /dev/null
+++ b/test/fixedbugs/issue15838.go
@@ -0,0 +1,12 @@
+// compiledir
+
+// Copyright 2016 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.
+
+// Test cases for issue #15838, and related failures.
+// Make sure the importer correctly sets up nodes for
+// label decls, goto, continue, break, and fallthrough
+// statements.
+
+package ignored
diff --git a/test/fixedbugs/issue15898.go b/test/fixedbugs/issue15898.go
new file mode 100644
index 0000000..7b66ea2
--- /dev/null
+++ b/test/fixedbugs/issue15898.go
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2016 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 p
+
+func f(e interface{}) {
+ switch e.(type) {
+ case nil, nil: // ERROR "multiple nil cases in type switch"
+ }
+
+ switch e.(type) {
+ case nil:
+ case nil: // ERROR "multiple nil cases in type switch"
+ }
+}
diff --git a/test/fixedbugs/issue15902.go b/test/fixedbugs/issue15902.go
new file mode 100644
index 0000000..9511a22
--- /dev/null
+++ b/test/fixedbugs/issue15902.go
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2016 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.
+
+// This test makes sure we don't use 4-byte unaligned writes
+// to zero memory on architectures that don't support them.
+
+package main
+
+type T struct {
+ a byte
+ b [10]byte
+}
+
+//go:noinline
+func f(t *T) {
+ // t will be aligned, so &t.b won't be.
+ t.b = [10]byte{}
+}
+
+var t T
+
+func main() {
+ f(&t)
+}
diff --git a/test/fixedbugs/issue15920.dir/a.go b/test/fixedbugs/issue15920.dir/a.go
new file mode 100644
index 0000000..15f9235
--- /dev/null
+++ b/test/fixedbugs/issue15920.dir/a.go
@@ -0,0 +1,9 @@
+// Copyright 2016 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
+
+type Error error
+
+func F() Error { return nil }
diff --git a/test/fixedbugs/issue15920.dir/b.go b/test/fixedbugs/issue15920.dir/b.go
new file mode 100644
index 0000000..0a36c5c
--- /dev/null
+++ b/test/fixedbugs/issue15920.dir/b.go
@@ -0,0 +1,7 @@
+// Copyright 2016 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"
diff --git a/test/fixedbugs/issue15920.go b/test/fixedbugs/issue15920.go
new file mode 100644
index 0000000..4d2844d
--- /dev/null
+++ b/test/fixedbugs/issue15920.go
@@ -0,0 +1,7 @@
+// compiledir
+
+// Copyright 2016 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 ignored
diff --git a/test/fixedbugs/issue15926.go b/test/fixedbugs/issue15926.go
new file mode 100644
index 0000000..76e25eb
--- /dev/null
+++ b/test/fixedbugs/issue15926.go
@@ -0,0 +1,20 @@
+// build
+
+// Copyright 2016 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 15926: linker was adding .def to the end of symbols, causing
+// a name collision with a method actually named def.
+
+package main
+
+type S struct{}
+
+func (s S) def() {}
+
+var I = S.def
+
+func main() {
+ I(S{})
+}
diff --git a/test/fixedbugs/issue15961.go b/test/fixedbugs/issue15961.go
new file mode 100644
index 0000000..db3d662
--- /dev/null
+++ b/test/fixedbugs/issue15961.go
@@ -0,0 +1,21 @@
+// compile
+
+// Copyright 2016 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 y
+
+type symSet []int
+
+//go:noinline
+func (s symSet) len() (r int) {
+ return 0
+}
+
+func f(m map[int]symSet) {
+ var symSet []int
+ for _, x := range symSet {
+ m[x] = nil
+ }
+}
diff --git a/test/fixedbugs/issue15975.go b/test/fixedbugs/issue15975.go
new file mode 100644
index 0000000..56a50e1
--- /dev/null
+++ b/test/fixedbugs/issue15975.go
@@ -0,0 +1,36 @@
+// run
+
+// Copyright 2016 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 main
+
+var fail bool
+
+type Closer interface {
+ Close()
+}
+
+func nilInterfaceDeferCall() {
+ var x Closer
+ defer x.Close()
+ // if it panics when evaluating x.Close, it should not reach here
+ fail = true
+}
+
+func shouldPanic(f func()) {
+ defer func() {
+ if recover() == nil {
+ panic("did not panic")
+ }
+ }()
+ f()
+}
+
+func main() {
+ shouldPanic(nilInterfaceDeferCall)
+ if fail {
+ panic("fail")
+ }
+}
diff --git a/test/fixedbugs/issue15988.go b/test/fixedbugs/issue15988.go
new file mode 100644
index 0000000..2bed2a9
--- /dev/null
+++ b/test/fixedbugs/issue15988.go
@@ -0,0 +1,14 @@
+// compile
+
+// Copyright 2016 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 p
+
+func f(p, q []int) {
+ p = append(q, 5)
+ sink = &p
+}
+
+var sink *[]int
diff --git a/test/fixedbugs/issue16008.go b/test/fixedbugs/issue16008.go
new file mode 100644
index 0000000..0e369ef
--- /dev/null
+++ b/test/fixedbugs/issue16008.go
@@ -0,0 +1,56 @@
+// errorcheck -0 -race
+
+// Copyright 2016 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 foo
+
+const benchmarkNumNodes = 10000
+
+func BenchmarkUpdateNodeTransaction(b B) {
+ s, nodeIDs := setupNodes(benchmarkNumNodes)
+ b.ResetTimer()
+ for i := 0; i < b.N(); i++ {
+ _ = s.Update(func(tx1 Tx) error {
+ _ = UpdateNode(tx1, &Node{
+ ID: nodeIDs[i%benchmarkNumNodes],
+ })
+ return nil
+ })
+ }
+}
+
+type B interface {
+ ResetTimer()
+ N() int
+}
+
+type Tx interface {
+}
+
+type Node struct {
+ ID string
+}
+
+type MemoryStore struct {
+}
+
+// go:noinline
+func setupNodes(n int) (s *MemoryStore, nodeIDs []string) {
+ return
+}
+
+//go:noinline
+func (s *MemoryStore) Update(cb func(Tx) error) error {
+ return nil
+}
+
+var sink interface{}
+
+//go:noinline
+func UpdateNode(tx Tx, n *Node) error {
+ sink = tx
+ sink = n
+ return nil
+}
diff --git a/test/fixedbugs/issue16016.go b/test/fixedbugs/issue16016.go
new file mode 100644
index 0000000..e738e1d
--- /dev/null
+++ b/test/fixedbugs/issue16016.go
@@ -0,0 +1,35 @@
+// run
+
+// Copyright 2016 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 main
+
+import "time"
+
+type T struct{}
+
+func (*T) Foo(vals []interface{}) {
+ switch v := vals[0].(type) {
+ case string:
+ _ = v
+ }
+}
+
+type R struct{ *T }
+
+type Q interface {
+ Foo([]interface{})
+}
+
+func main() {
+ var q Q = &R{&T{}}
+ for i := 0; i < 10000; i++ {
+ go func() {
+ defer q.Foo([]interface{}{"meow"})
+ time.Sleep(100 * time.Millisecond)
+ }()
+ }
+ time.Sleep(1 * time.Second)
+}
diff --git a/test/fixedbugs/issue16037_run.go b/test/fixedbugs/issue16037_run.go
new file mode 100644
index 0000000..23fff59
--- /dev/null
+++ b/test/fixedbugs/issue16037_run.go
@@ -0,0 +1,70 @@
+// +build !nacl,!android
+// run
+
+// Copyright 2016 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 main
+
+import (
+ "bytes"
+ "fmt"
+ "html/template"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+)
+
+var tmpl = template.Must(template.New("main").Parse(`
+package main
+
+type T struct {
+ {{range .Names}}
+ {{.Name}} *string
+ {{end}}
+}
+
+{{range .Names}}
+func (t *T) Get{{.Name}}() string {
+ if t.{{.Name}} == nil {
+ return ""
+ }
+ return *t.{{.Name}}
+}
+{{end}}
+
+func main() {}
+`))
+
+func main() {
+ const n = 5000
+
+ type Name struct{ Name string }
+ var t struct{ Names []Name }
+ for i := 0; i < n; i++ {
+ t.Names = append(t.Names, Name{Name: fmt.Sprintf("H%06X", i)})
+ }
+
+ buf := new(bytes.Buffer)
+ if err := tmpl.Execute(buf, t); err != nil {
+ log.Fatal(err)
+ }
+
+ dir, err := ioutil.TempDir("", "issue16037-")
+ if err != nil {
+ log.Fatal(err)
+ }
+ defer os.RemoveAll(dir)
+ path := filepath.Join(dir, "ridiculous_number_of_fields.go")
+ if err := ioutil.WriteFile(path, buf.Bytes(), 0664); err != nil {
+ log.Fatal(err)
+ }
+
+ out, err := exec.Command("go", "build", "-o="+filepath.Join(dir, "out"), path).CombinedOutput()
+ if err != nil {
+ log.Fatalf("build failed: %v\n%s", err, out)
+ }
+}
diff --git a/test/fixedbugs/issue16095.go b/test/fixedbugs/issue16095.go
new file mode 100644
index 0000000..864b4b7
--- /dev/null
+++ b/test/fixedbugs/issue16095.go
@@ -0,0 +1,104 @@
+// run
+
+// Copyright 2016 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 main
+
+import (
+ "fmt"
+ "runtime"
+)
+
+var sink *[20]byte
+
+func f() (x [20]byte) {
+ // Initialize x.
+ for i := range x {
+ x[i] = byte(i)
+ }
+
+ // Force x to be allocated on the heap.
+ sink = &x
+ sink = nil
+
+ // Go to deferreturn after the panic below.
+ defer func() {
+ recover()
+ }()
+
+ // This call collects the heap-allocated version of x (oops!)
+ runtime.GC()
+
+ // Allocate that same object again and clobber it.
+ y := new([20]byte)
+ for i := 0; i < 20; i++ {
+ y[i] = 99
+ }
+ // Make sure y is heap allocated.
+ sink = y
+
+ panic(nil)
+
+ // After the recover we reach the deferreturn, which
+ // copies the heap version of x back to the stack.
+ // It gets the pointer to x from a stack slot that was
+ // not marked as live during the call to runtime.GC().
+}
+
+var sinkint int
+
+func g(p *int) (x [20]byte) {
+ // Initialize x.
+ for i := range x {
+ x[i] = byte(i)
+ }
+
+ // Force x to be allocated on the heap.
+ sink = &x
+ sink = nil
+
+ // Go to deferreturn after the panic below.
+ defer func() {
+ recover()
+ }()
+
+ // This call collects the heap-allocated version of x (oops!)
+ runtime.GC()
+
+ // Allocate that same object again and clobber it.
+ y := new([20]byte)
+ for i := 0; i < 20; i++ {
+ y[i] = 99
+ }
+ // Make sure y is heap allocated.
+ sink = y
+
+ // panic with a non-call (with no fallthrough)
+ for {
+ sinkint = *p
+ }
+
+ // After the recover we reach the deferreturn, which
+ // copies the heap version of x back to the stack.
+ // It gets the pointer to x from a stack slot that was
+ // not marked as live during the call to runtime.GC().
+}
+
+func main() {
+ x := f()
+ for i, v := range x {
+ if v != byte(i) {
+ fmt.Printf("%v\n", x)
+ panic("bad f")
+ }
+ }
+ x = g(nil)
+ for i, v := range x {
+ if v != byte(i) {
+ fmt.Printf("%v\n", x)
+ panic("bad g")
+ }
+ }
+}
diff --git a/test/fixedbugs/issue16130.go b/test/fixedbugs/issue16130.go
new file mode 100644
index 0000000..19c8264
--- /dev/null
+++ b/test/fixedbugs/issue16130.go
@@ -0,0 +1,43 @@
+// run
+
+// Copyright 2016 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.
+
+// Test that an interface conversion error panics with an "interface
+// conversion" run-time error. It was (incorrectly) panicing with a
+// "nil pointer dereference."
+
+package main
+
+import (
+ "fmt"
+ "runtime"
+ "strings"
+)
+
+type I interface {
+ Get() int
+}
+
+func main() {
+ defer func() {
+ r := recover()
+ if r == nil {
+ panic("expected panic")
+ }
+ re, ok := r.(runtime.Error)
+ if !ok {
+ panic(fmt.Sprintf("got %T, expected runtime.Error", r))
+ }
+ if !strings.Contains(re.Error(), "interface conversion") {
+ panic(fmt.Sprintf("got %q, expected interface conversion error", re.Error()))
+ }
+ }()
+ e := (interface{})(0)
+ if _, ok := e.(I); ok {
+ panic("unexpected interface conversion success")
+ }
+ fmt.Println(e.(I))
+ panic("unexpected interface conversion success")
+}
diff --git a/test/fixedbugs/issue16133.dir/a1.go b/test/fixedbugs/issue16133.dir/a1.go
new file mode 100644
index 0000000..497cccf
--- /dev/null
+++ b/test/fixedbugs/issue16133.dir/a1.go
@@ -0,0 +1,7 @@
+package a
+
+type X string
+
+func NewX() X {
+ return ""
+}
diff --git a/test/fixedbugs/issue16133.dir/a2.go b/test/fixedbugs/issue16133.dir/a2.go
new file mode 100644
index 0000000..497cccf
--- /dev/null
+++ b/test/fixedbugs/issue16133.dir/a2.go
@@ -0,0 +1,7 @@
+package a
+
+type X string
+
+func NewX() X {
+ return ""
+}
diff --git a/test/fixedbugs/issue16133.dir/b.go b/test/fixedbugs/issue16133.dir/b.go
new file mode 100644
index 0000000..be1bebf
--- /dev/null
+++ b/test/fixedbugs/issue16133.dir/b.go
@@ -0,0 +1,7 @@
+package b
+
+import "./a2"
+
+type T struct {
+ X a.X
+}
diff --git a/test/fixedbugs/issue16133.dir/c.go b/test/fixedbugs/issue16133.dir/c.go
new file mode 100644
index 0000000..b25fe5a
--- /dev/null
+++ b/test/fixedbugs/issue16133.dir/c.go
@@ -0,0 +1,10 @@
+package p
+
+import (
+ "./a1"
+ "./b"
+)
+
+var _ = b.T{
+ X: a.NewX(), // ERROR `cannot use "a1"\.NewX\(\)`
+}
diff --git a/test/fixedbugs/issue16133.go b/test/fixedbugs/issue16133.go
new file mode 100644
index 0000000..4afffc5
--- /dev/null
+++ b/test/fixedbugs/issue16133.go
@@ -0,0 +1,10 @@
+// errorcheckdir -s
+
+// Copyright 2016 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.
+
+// Verify error messages referring to multiple different
+// packages with the same package name.
+
+package ignored
diff --git a/test/fixedbugs/issue16193.go b/test/fixedbugs/issue16193.go
new file mode 100644
index 0000000..eada62d
--- /dev/null
+++ b/test/fixedbugs/issue16193.go
@@ -0,0 +1,27 @@
+// compile
+
+// Copyright 2016 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.
+
+// The compiler used the name "glob" as the function holding a global
+// function literal, colliding with an actual function named "glob".
+
+package main
+
+func glob() {
+ func() {
+ }()
+}
+
+var c1 = func() {
+}
+
+var c2 = func() {
+}
+
+func main() {
+ glob()
+ c1()
+ c2()
+}
diff --git a/test/fixedbugs/issue16249.go b/test/fixedbugs/issue16249.go
new file mode 100644
index 0000000..723d5d9
--- /dev/null
+++ b/test/fixedbugs/issue16249.go
@@ -0,0 +1,58 @@
+// run
+
+// Copyright 2016 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.
+
+// Liveness calculations were wrong for a result parameter pushed onto
+// the heap in a function that used defer. Program would crash with
+// runtime: bad pointer in frame main.A at 0xc4201e6838: 0x1
+
+package main
+
+import "errors"
+
+var sink interface{}
+
+//go:noinline
+func f(err *error) {
+ if err != nil {
+ sink = err
+ }
+}
+
+//go:noinline
+func A(n, m int64) (res int64, err error) {
+ defer f(&err) // output parameter's address escapes to a defer.
+ if n < 0 {
+ err = errors.New("No negative")
+ return
+ }
+ if n <= 1 {
+ res = n
+ return
+ }
+ res = B(m) // This call to B drizzles a little junk on the stack.
+ res, err = A(n-1, m)
+ res++
+ return
+}
+
+// B does a little bit of recursion dribbling not-zero onto the stack.
+//go:noinline
+func B(n int64) (res int64) {
+ if n <= 1 { // Prefer to leave a 1 on the stack.
+ return n
+ }
+ return 1 + B(n-1)
+}
+
+func main() {
+ x, e := A(0, 0)
+ for j := 0; j < 4; j++ { // j controls amount of B's stack dribble
+ for i := 0; i < 1000; i++ { // try more and more recursion until stack growth occurs in newobject in prologue
+ x, e = A(int64(i), int64(j))
+ }
+ }
+ _, _ = x, e
+}
diff --git a/test/fixedbugs/issue2615.go b/test/fixedbugs/issue2615.go
index 686e1e1..831110e 100644
--- a/test/fixedbugs/issue2615.go
+++ b/test/fixedbugs/issue2615.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue3552.dir/one.go b/test/fixedbugs/issue3552.dir/one.go
index 491ada1..e594db7 100644
--- a/test/fixedbugs/issue3552.dir/one.go
+++ b/test/fixedbugs/issue3552.dir/one.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue3552.dir/two.go b/test/fixedbugs/issue3552.dir/two.go
index 1366d24..2f330bf 100644
--- a/test/fixedbugs/issue3552.dir/two.go
+++ b/test/fixedbugs/issue3552.dir/two.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue3705.go b/test/fixedbugs/issue3705.go
index 64ef38b..ed0a193 100644
--- a/test/fixedbugs/issue3705.go
+++ b/test/fixedbugs/issue3705.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue3783.go b/test/fixedbugs/issue3783.go
index d7a4a2e..7db06d1 100644
--- a/test/fixedbugs/issue3783.go
+++ b/test/fixedbugs/issue3783.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue3925.go b/test/fixedbugs/issue3925.go
index a62d439..628c222 100644
--- a/test/fixedbugs/issue3925.go
+++ b/test/fixedbugs/issue3925.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4085a.go b/test/fixedbugs/issue4085a.go
index 089637d..200290a 100644
--- a/test/fixedbugs/issue4085a.go
+++ b/test/fixedbugs/issue4085a.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4085b.go b/test/fixedbugs/issue4085b.go
index 63aca23..583c417 100644
--- a/test/fixedbugs/issue4085b.go
+++ b/test/fixedbugs/issue4085b.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4097.go b/test/fixedbugs/issue4097.go
index c2b7d9b..30b65bc 100644
--- a/test/fixedbugs/issue4097.go
+++ b/test/fixedbugs/issue4097.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4099.go b/test/fixedbugs/issue4099.go
index 89392bf..8ea809c 100644
--- a/test/fixedbugs/issue4099.go
+++ b/test/fixedbugs/issue4099.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4162.go b/test/fixedbugs/issue4162.go
index c2a8338..f236bd0 100644
--- a/test/fixedbugs/issue4162.go
+++ b/test/fixedbugs/issue4162.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4167.go b/test/fixedbugs/issue4167.go
index 4e35331..86a636f 100644
--- a/test/fixedbugs/issue4167.go
+++ b/test/fixedbugs/issue4167.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4232.go b/test/fixedbugs/issue4232.go
index 755b1b1..935f382 100644
--- a/test/fixedbugs/issue4232.go
+++ b/test/fixedbugs/issue4232.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4251.go b/test/fixedbugs/issue4251.go
index 3668d4c..d11ce51 100644
--- a/test/fixedbugs/issue4251.go
+++ b/test/fixedbugs/issue4251.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4252.dir/a.go b/test/fixedbugs/issue4252.dir/a.go
index 089b6f2..a587e28 100644
--- a/test/fixedbugs/issue4252.dir/a.go
+++ b/test/fixedbugs/issue4252.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4252.dir/main.go b/test/fixedbugs/issue4252.dir/main.go
index 28e4342..02d9836 100644
--- a/test/fixedbugs/issue4252.dir/main.go
+++ b/test/fixedbugs/issue4252.dir/main.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4252.go b/test/fixedbugs/issue4252.go
index 1b0e5b2..01bcbc4 100644
--- a/test/fixedbugs/issue4252.go
+++ b/test/fixedbugs/issue4252.go
@@ -1,6 +1,6 @@
// rundir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4283.go b/test/fixedbugs/issue4283.go
index 128c872..fa5629b 100644
--- a/test/fixedbugs/issue4283.go
+++ b/test/fixedbugs/issue4283.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4313.go b/test/fixedbugs/issue4313.go
index b2f69db..2494b83 100644
--- a/test/fixedbugs/issue4313.go
+++ b/test/fixedbugs/issue4313.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4316.go b/test/fixedbugs/issue4316.go
index bb18a08..de9a61b 100644
--- a/test/fixedbugs/issue4316.go
+++ b/test/fixedbugs/issue4316.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4323.go b/test/fixedbugs/issue4323.go
index 6bb78f4..f082a1f 100644
--- a/test/fixedbugs/issue4323.go
+++ b/test/fixedbugs/issue4323.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4326.go b/test/fixedbugs/issue4326.go
index 5ce2eea..6a510f9 100644
--- a/test/fixedbugs/issue4326.go
+++ b/test/fixedbugs/issue4326.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4348.go b/test/fixedbugs/issue4348.go
index 3dac8f7..c59b6b8 100644
--- a/test/fixedbugs/issue4348.go
+++ b/test/fixedbugs/issue4348.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4353.go b/test/fixedbugs/issue4353.go
index defe7c3..6a17c46 100644
--- a/test/fixedbugs/issue4353.go
+++ b/test/fixedbugs/issue4353.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4359.go b/test/fixedbugs/issue4359.go
index b5adb40..c79e9e2 100644
--- a/test/fixedbugs/issue4359.go
+++ b/test/fixedbugs/issue4359.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4365.go b/test/fixedbugs/issue4365.go
index 04d31f7..09ff1bf 100644
--- a/test/fixedbugs/issue4365.go
+++ b/test/fixedbugs/issue4365.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue4370.dir/p1.go b/test/fixedbugs/issue4370.dir/p1.go
index d732c8b..d010e93 100644
--- a/test/fixedbugs/issue4370.dir/p1.go
+++ b/test/fixedbugs/issue4370.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4370.dir/p2.go b/test/fixedbugs/issue4370.dir/p2.go
index 33370d0..0d3e236 100644
--- a/test/fixedbugs/issue4370.dir/p2.go
+++ b/test/fixedbugs/issue4370.dir/p2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4370.dir/p3.go b/test/fixedbugs/issue4370.dir/p3.go
index 13c996b..c275c6e 100644
--- a/test/fixedbugs/issue4370.dir/p3.go
+++ b/test/fixedbugs/issue4370.dir/p3.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4370.go b/test/fixedbugs/issue4370.go
index 76b47e1..b1d0364 100644
--- a/test/fixedbugs/issue4370.go
+++ b/test/fixedbugs/issue4370.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4388.go b/test/fixedbugs/issue4388.go
index b18c98b..5bb05eb 100644
--- a/test/fixedbugs/issue4388.go
+++ b/test/fixedbugs/issue4388.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue4396a.go b/test/fixedbugs/issue4396a.go
index 11ae1f7..38dd4b8 100644
--- a/test/fixedbugs/issue4396a.go
+++ b/test/fixedbugs/issue4396a.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4396b.go b/test/fixedbugs/issue4396b.go
index d0bf28f..1284870 100644
--- a/test/fixedbugs/issue4396b.go
+++ b/test/fixedbugs/issue4396b.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4399.go b/test/fixedbugs/issue4399.go
index 6674db9..3dc2126 100644
--- a/test/fixedbugs/issue4399.go
+++ b/test/fixedbugs/issue4399.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4405.go b/test/fixedbugs/issue4405.go
index b8458d7..5ba3e10 100644
--- a/test/fixedbugs/issue4405.go
+++ b/test/fixedbugs/issue4405.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4429.go b/test/fixedbugs/issue4429.go
index 6822760..9eb2e0f 100644
--- a/test/fixedbugs/issue4429.go
+++ b/test/fixedbugs/issue4429.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4448.go b/test/fixedbugs/issue4448.go
index fa1d9fe..f5e4715 100644
--- a/test/fixedbugs/issue4448.go
+++ b/test/fixedbugs/issue4448.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4452.go b/test/fixedbugs/issue4452.go
index 54dd214..f91bd2c 100644
--- a/test/fixedbugs/issue4452.go
+++ b/test/fixedbugs/issue4452.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4458.go b/test/fixedbugs/issue4458.go
index 820f18c..98ffea7 100644
--- a/test/fixedbugs/issue4458.go
+++ b/test/fixedbugs/issue4458.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4463.go b/test/fixedbugs/issue4463.go
index 70977ce..6ad1952 100644
--- a/test/fixedbugs/issue4463.go
+++ b/test/fixedbugs/issue4463.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4468.go b/test/fixedbugs/issue4468.go
index ef0b46b..d26725e 100644
--- a/test/fixedbugs/issue4468.go
+++ b/test/fixedbugs/issue4468.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
@@ -19,8 +19,12 @@
}
func F() {
- go (F()) // ERROR "must be function call"
- defer (F()) // ERROR "must be function call"
+ go F // ERROR "must be function call"
+ defer F // ERROR "must be function call"
+ go (F) // ERROR "must be function call|must not be parenthesized"
+ defer (F) // ERROR "must be function call|must not be parenthesized"
+ go (F()) // ERROR "must be function call|must not be parenthesized"
+ defer (F()) // ERROR "must be function call|must not be parenthesized"
var s S
(&s.t).F()
go (&s.t).F()
diff --git a/test/fixedbugs/issue4470.go b/test/fixedbugs/issue4470.go
index 5ed09ca..d922478 100644
--- a/test/fixedbugs/issue4470.go
+++ b/test/fixedbugs/issue4470.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4495.go b/test/fixedbugs/issue4495.go
index 7ec1134..308acc2 100644
--- a/test/fixedbugs/issue4495.go
+++ b/test/fixedbugs/issue4495.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4517a.go b/test/fixedbugs/issue4517a.go
index a1b6b57..83d42e7 100644
--- a/test/fixedbugs/issue4517a.go
+++ b/test/fixedbugs/issue4517a.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4517b.go b/test/fixedbugs/issue4517b.go
index f04103f..34fa98f 100644
--- a/test/fixedbugs/issue4517b.go
+++ b/test/fixedbugs/issue4517b.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4517c.go b/test/fixedbugs/issue4517c.go
index 47b21cf..9023e0a 100644
--- a/test/fixedbugs/issue4517c.go
+++ b/test/fixedbugs/issue4517c.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4517d.go b/test/fixedbugs/issue4517d.go
index 3d727d4..197c225 100644
--- a/test/fixedbugs/issue4517d.go
+++ b/test/fixedbugs/issue4517d.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4518.go b/test/fixedbugs/issue4518.go
index e64b069..c482b0f 100644
--- a/test/fixedbugs/issue4518.go
+++ b/test/fixedbugs/issue4518.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
@@ -10,15 +10,13 @@
package main
-func DontInline() {}
-
+//go:noinline
func F(e interface{}) (int, int) {
- DontInline()
return 3, 7
}
+//go:noinline
func G() (int, int) {
- DontInline()
return 3, 7
}
diff --git a/test/fixedbugs/issue4529.go b/test/fixedbugs/issue4529.go
index 4f37e7c..66b96c7 100644
--- a/test/fixedbugs/issue4529.go
+++ b/test/fixedbugs/issue4529.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4545.go b/test/fixedbugs/issue4545.go
index c37ccef..534ba71 100644
--- a/test/fixedbugs/issue4545.go
+++ b/test/fixedbugs/issue4545.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4562.go b/test/fixedbugs/issue4562.go
index 29d98b0..8c958f5 100644
--- a/test/fixedbugs/issue4562.go
+++ b/test/fixedbugs/issue4562.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4585.go b/test/fixedbugs/issue4585.go
index ad1242d..9191ec5 100644
--- a/test/fixedbugs/issue4585.go
+++ b/test/fixedbugs/issue4585.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4590.dir/pkg1.go b/test/fixedbugs/issue4590.dir/pkg1.go
index c447371..96cac0a 100644
--- a/test/fixedbugs/issue4590.dir/pkg1.go
+++ b/test/fixedbugs/issue4590.dir/pkg1.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4590.dir/pkg2.go b/test/fixedbugs/issue4590.dir/pkg2.go
index 61c01d7..98bc2a5 100644
--- a/test/fixedbugs/issue4590.dir/pkg2.go
+++ b/test/fixedbugs/issue4590.dir/pkg2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4590.dir/prog.go b/test/fixedbugs/issue4590.dir/prog.go
index 3220e85..32055b2 100644
--- a/test/fixedbugs/issue4590.dir/prog.go
+++ b/test/fixedbugs/issue4590.dir/prog.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4614.go b/test/fixedbugs/issue4614.go
index 1aa318c..ad378d8 100644
--- a/test/fixedbugs/issue4614.go
+++ b/test/fixedbugs/issue4614.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue4618.go b/test/fixedbugs/issue4618.go
index fe875b3..0ba9523 100644
--- a/test/fixedbugs/issue4618.go
+++ b/test/fixedbugs/issue4618.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4620.go b/test/fixedbugs/issue4620.go
index 7b4ebf9..5aa2908 100644
--- a/test/fixedbugs/issue4620.go
+++ b/test/fixedbugs/issue4620.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4654.go b/test/fixedbugs/issue4654.go
index d3f582b..76aff76 100644
--- a/test/fixedbugs/issue4654.go
+++ b/test/fixedbugs/issue4654.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4663.go b/test/fixedbugs/issue4663.go
index edaee93..971290d 100644
--- a/test/fixedbugs/issue4663.go
+++ b/test/fixedbugs/issue4663.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4667.go b/test/fixedbugs/issue4667.go
index 18d773c..31b3284 100644
--- a/test/fixedbugs/issue4667.go
+++ b/test/fixedbugs/issue4667.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4734.go b/test/fixedbugs/issue4734.go
index 69f66f2..45e609d 100644
--- a/test/fixedbugs/issue4734.go
+++ b/test/fixedbugs/issue4734.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4748.go b/test/fixedbugs/issue4748.go
index 73c7539..f7c77cf 100644
--- a/test/fixedbugs/issue4748.go
+++ b/test/fixedbugs/issue4748.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4752.go b/test/fixedbugs/issue4752.go
index d6781e3..af7bb92 100644
--- a/test/fixedbugs/issue4752.go
+++ b/test/fixedbugs/issue4752.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4776.go b/test/fixedbugs/issue4776.go
index 13781af..a1009ad 100644
--- a/test/fixedbugs/issue4776.go
+++ b/test/fixedbugs/issue4776.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4785.go b/test/fixedbugs/issue4785.go
index c3dd629..d0bcd56 100644
--- a/test/fixedbugs/issue4785.go
+++ b/test/fixedbugs/issue4785.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4909a.go b/test/fixedbugs/issue4909a.go
index aefe2d6..09e1b85 100644
--- a/test/fixedbugs/issue4909a.go
+++ b/test/fixedbugs/issue4909a.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue4964.dir/a.go b/test/fixedbugs/issue4964.dir/a.go
index 2b9e44e..216f352 100644
--- a/test/fixedbugs/issue4964.dir/a.go
+++ b/test/fixedbugs/issue4964.dir/a.go
@@ -10,16 +10,14 @@
Pointer *int
}
-func dontinline() {}
-
+//go:noinline
func Store(t *T) {
global = t.Pointer
- dontinline()
}
+//go:noinline
func Store2(t *T) {
global2 = t.Pointer
- dontinline()
}
func Get() *int {
diff --git a/test/fixedbugs/issue5002.go b/test/fixedbugs/issue5002.go
index 1e74fa1..5ac119a 100644
--- a/test/fixedbugs/issue5002.go
+++ b/test/fixedbugs/issue5002.go
@@ -1,6 +1,6 @@
// build
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5056.go b/test/fixedbugs/issue5056.go
index a2cde2a..6fb444a 100644
--- a/test/fixedbugs/issue5056.go
+++ b/test/fixedbugs/issue5056.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5089.go b/test/fixedbugs/issue5089.go
index 81b9f05..9f7fa5a 100644
--- a/test/fixedbugs/issue5089.go
+++ b/test/fixedbugs/issue5089.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5231.go b/test/fixedbugs/issue5231.go
index 4039913..6bc8826 100644
--- a/test/fixedbugs/issue5231.go
+++ b/test/fixedbugs/issue5231.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5358.go b/test/fixedbugs/issue5358.go
index c2b1da9..25f1e52 100644
--- a/test/fixedbugs/issue5358.go
+++ b/test/fixedbugs/issue5358.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5373.go b/test/fixedbugs/issue5373.go
index 17ce189..8aee9a2 100644
--- a/test/fixedbugs/issue5373.go
+++ b/test/fixedbugs/issue5373.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue5581.go b/test/fixedbugs/issue5581.go
index 36a4ad6..8834b44 100644
--- a/test/fixedbugs/issue5581.go
+++ b/test/fixedbugs/issue5581.go
@@ -3,7 +3,7 @@
// Used to emit a spurious "invalid recursive type" error.
// See golang.org/issue/5581.
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5698.go b/test/fixedbugs/issue5698.go
index 035bbd3..081541c 100644
--- a/test/fixedbugs/issue5698.go
+++ b/test/fixedbugs/issue5698.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5704.go b/test/fixedbugs/issue5704.go
index 1dfa072..11b9a93 100644
--- a/test/fixedbugs/issue5704.go
+++ b/test/fixedbugs/issue5704.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue5793.go b/test/fixedbugs/issue5793.go
index f5a9965..8104155 100644
--- a/test/fixedbugs/issue5793.go
+++ b/test/fixedbugs/issue5793.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5809.go b/test/fixedbugs/issue5809.go
index ca060b5..fc8eeef 100644
--- a/test/fixedbugs/issue5809.go
+++ b/test/fixedbugs/issue5809.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5820.go b/test/fixedbugs/issue5820.go
index 94de06d..1046d66 100644
--- a/test/fixedbugs/issue5820.go
+++ b/test/fixedbugs/issue5820.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5841.go b/test/fixedbugs/issue5841.go
index cfc4a50..2be1aee 100644
--- a/test/fixedbugs/issue5841.go
+++ b/test/fixedbugs/issue5841.go
@@ -1,6 +1,6 @@
// build
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5856.go b/test/fixedbugs/issue5856.go
index 78ca3b9..5e16c78 100644
--- a/test/fixedbugs/issue5856.go
+++ b/test/fixedbugs/issue5856.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue5957.dir/c.go b/test/fixedbugs/issue5957.dir/c.go
index a1781d4..d115eac 100644
--- a/test/fixedbugs/issue5957.dir/c.go
+++ b/test/fixedbugs/issue5957.dir/c.go
@@ -2,7 +2,7 @@
import (
"./a" // ERROR "imported and not used: \x22a\x22 as surprise|imported and not used: surprise"
- "./b" // GC_ERROR "imported and not used: \x22b\x22 as surprise2|imported and not used: surprise2"
+ "./b" // ERROR "imported and not used: \x22b\x22 as surprise2|imported and not used: surprise2"
b "./b" // ERROR "imported and not used: \x22b\x22$|imported and not used: surprise2"
foo "math" // ERROR "imported and not used: \x22math\x22 as foo|imported and not used: math"
"fmt" // actually used
diff --git a/test/fixedbugs/issue5963.go b/test/fixedbugs/issue5963.go
index 190e8f4..f828303 100644
--- a/test/fixedbugs/issue5963.go
+++ b/test/fixedbugs/issue5963.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6004.go b/test/fixedbugs/issue6004.go
index 45aaffd..2b3dcd9 100644
--- a/test/fixedbugs/issue6004.go
+++ b/test/fixedbugs/issue6004.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6036.go b/test/fixedbugs/issue6036.go
index 5f787c5..795b223 100644
--- a/test/fixedbugs/issue6036.go
+++ b/test/fixedbugs/issue6036.go
@@ -1,7 +1,7 @@
// +build amd64
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6055.go b/test/fixedbugs/issue6055.go
index 698f62a..4594348 100644
--- a/test/fixedbugs/issue6055.go
+++ b/test/fixedbugs/issue6055.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6131.go b/test/fixedbugs/issue6131.go
index 817e4a8..61548a2 100644
--- a/test/fixedbugs/issue6131.go
+++ b/test/fixedbugs/issue6131.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6140.go b/test/fixedbugs/issue6140.go
index d494933..dde7921 100644
--- a/test/fixedbugs/issue6140.go
+++ b/test/fixedbugs/issue6140.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6247.go b/test/fixedbugs/issue6247.go
index eea8f9c..2786786 100644
--- a/test/fixedbugs/issue6247.go
+++ b/test/fixedbugs/issue6247.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6269.go b/test/fixedbugs/issue6269.go
index af5feb7..2930f52 100644
--- a/test/fixedbugs/issue6269.go
+++ b/test/fixedbugs/issue6269.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6295.dir/p0.go b/test/fixedbugs/issue6295.dir/p0.go
index cf86fbc..d4d4da7 100644
--- a/test/fixedbugs/issue6295.dir/p0.go
+++ b/test/fixedbugs/issue6295.dir/p0.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6295.dir/p1.go b/test/fixedbugs/issue6295.dir/p1.go
index 974d02f..26efae7 100644
--- a/test/fixedbugs/issue6295.dir/p1.go
+++ b/test/fixedbugs/issue6295.dir/p1.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6295.dir/p2.go b/test/fixedbugs/issue6295.dir/p2.go
index 4703ec0..f5b6ffd 100644
--- a/test/fixedbugs/issue6295.dir/p2.go
+++ b/test/fixedbugs/issue6295.dir/p2.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6298.go b/test/fixedbugs/issue6298.go
index 6303dbe..ab3bfcd 100644
--- a/test/fixedbugs/issue6298.go
+++ b/test/fixedbugs/issue6298.go
@@ -3,7 +3,7 @@
// golang.org/issue/6298.
// Used to cause "internal error: typename ideal bool"
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6513.dir/a.go b/test/fixedbugs/issue6513.dir/a.go
index da90ca3..e5536fe 100644
--- a/test/fixedbugs/issue6513.dir/a.go
+++ b/test/fixedbugs/issue6513.dir/a.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6513.dir/b.go b/test/fixedbugs/issue6513.dir/b.go
index 3b35b2d..ce3d52e 100644
--- a/test/fixedbugs/issue6513.dir/b.go
+++ b/test/fixedbugs/issue6513.dir/b.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6513.dir/main.go b/test/fixedbugs/issue6513.dir/main.go
index f09b727..8d8c02b 100644
--- a/test/fixedbugs/issue6513.dir/main.go
+++ b/test/fixedbugs/issue6513.dir/main.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6572.go b/test/fixedbugs/issue6572.go
index e75da54..e4465e9 100644
--- a/test/fixedbugs/issue6572.go
+++ b/test/fixedbugs/issue6572.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6671.go b/test/fixedbugs/issue6671.go
index b88faa4..ce43f31 100644
--- a/test/fixedbugs/issue6671.go
+++ b/test/fixedbugs/issue6671.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703a.go b/test/fixedbugs/issue6703a.go
index d4c008f..38c5956 100644
--- a/test/fixedbugs/issue6703a.go
+++ b/test/fixedbugs/issue6703a.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703b.go b/test/fixedbugs/issue6703b.go
index 326b583..35438c3 100644
--- a/test/fixedbugs/issue6703b.go
+++ b/test/fixedbugs/issue6703b.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703c.go b/test/fixedbugs/issue6703c.go
index 4735764..ade40e3 100644
--- a/test/fixedbugs/issue6703c.go
+++ b/test/fixedbugs/issue6703c.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703d.go b/test/fixedbugs/issue6703d.go
index 0a1952f..dd48163 100644
--- a/test/fixedbugs/issue6703d.go
+++ b/test/fixedbugs/issue6703d.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703e.go b/test/fixedbugs/issue6703e.go
index 416066e..d362d6e 100644
--- a/test/fixedbugs/issue6703e.go
+++ b/test/fixedbugs/issue6703e.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703f.go b/test/fixedbugs/issue6703f.go
index 3023829..0b49026 100644
--- a/test/fixedbugs/issue6703f.go
+++ b/test/fixedbugs/issue6703f.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703g.go b/test/fixedbugs/issue6703g.go
index 002b5a6..05ec740 100644
--- a/test/fixedbugs/issue6703g.go
+++ b/test/fixedbugs/issue6703g.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703h.go b/test/fixedbugs/issue6703h.go
index 234ccb3..f6b69e1 100644
--- a/test/fixedbugs/issue6703h.go
+++ b/test/fixedbugs/issue6703h.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703i.go b/test/fixedbugs/issue6703i.go
index 78b4d49..fb580a2 100644
--- a/test/fixedbugs/issue6703i.go
+++ b/test/fixedbugs/issue6703i.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703j.go b/test/fixedbugs/issue6703j.go
index a7f63f7..b4c079f 100644
--- a/test/fixedbugs/issue6703j.go
+++ b/test/fixedbugs/issue6703j.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703k.go b/test/fixedbugs/issue6703k.go
index 19c6107..6f606e2 100644
--- a/test/fixedbugs/issue6703k.go
+++ b/test/fixedbugs/issue6703k.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703l.go b/test/fixedbugs/issue6703l.go
index 3f4ca31..684c225 100644
--- a/test/fixedbugs/issue6703l.go
+++ b/test/fixedbugs/issue6703l.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703m.go b/test/fixedbugs/issue6703m.go
index d80959c..7d1b604 100644
--- a/test/fixedbugs/issue6703m.go
+++ b/test/fixedbugs/issue6703m.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703n.go b/test/fixedbugs/issue6703n.go
index 2c623f2..22646af 100644
--- a/test/fixedbugs/issue6703n.go
+++ b/test/fixedbugs/issue6703n.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703o.go b/test/fixedbugs/issue6703o.go
index efc8947..a11fdfd 100644
--- a/test/fixedbugs/issue6703o.go
+++ b/test/fixedbugs/issue6703o.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703p.go b/test/fixedbugs/issue6703p.go
index dad88f6..3ac7a63 100644
--- a/test/fixedbugs/issue6703p.go
+++ b/test/fixedbugs/issue6703p.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703q.go b/test/fixedbugs/issue6703q.go
index 7bd748a..b087c15 100644
--- a/test/fixedbugs/issue6703q.go
+++ b/test/fixedbugs/issue6703q.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703r.go b/test/fixedbugs/issue6703r.go
index 6698462..de514f1 100644
--- a/test/fixedbugs/issue6703r.go
+++ b/test/fixedbugs/issue6703r.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703s.go b/test/fixedbugs/issue6703s.go
index 6aa2848..cd3c5b3 100644
--- a/test/fixedbugs/issue6703s.go
+++ b/test/fixedbugs/issue6703s.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703t.go b/test/fixedbugs/issue6703t.go
index bad65ad..62de37c 100644
--- a/test/fixedbugs/issue6703t.go
+++ b/test/fixedbugs/issue6703t.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703u.go b/test/fixedbugs/issue6703u.go
index b6813b7..961a000 100644
--- a/test/fixedbugs/issue6703u.go
+++ b/test/fixedbugs/issue6703u.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703v.go b/test/fixedbugs/issue6703v.go
index a1b3711..2409911 100644
--- a/test/fixedbugs/issue6703v.go
+++ b/test/fixedbugs/issue6703v.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703w.go b/test/fixedbugs/issue6703w.go
index d4733de..b7b3d91 100644
--- a/test/fixedbugs/issue6703w.go
+++ b/test/fixedbugs/issue6703w.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703x.go b/test/fixedbugs/issue6703x.go
index 8008b8c..48daf03 100644
--- a/test/fixedbugs/issue6703x.go
+++ b/test/fixedbugs/issue6703x.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703y.go b/test/fixedbugs/issue6703y.go
index ac4526d..278dfcd 100644
--- a/test/fixedbugs/issue6703y.go
+++ b/test/fixedbugs/issue6703y.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6703z.go b/test/fixedbugs/issue6703z.go
index d4c17e1..f81a3a8 100644
--- a/test/fixedbugs/issue6703z.go
+++ b/test/fixedbugs/issue6703z.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6847.go b/test/fixedbugs/issue6847.go
index e6427e1..da300bc 100644
--- a/test/fixedbugs/issue6847.go
+++ b/test/fixedbugs/issue6847.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue6899.go b/test/fixedbugs/issue6899.go
index a693bf2..f98f551 100644
--- a/test/fixedbugs/issue6899.go
+++ b/test/fixedbugs/issue6899.go
@@ -1,6 +1,6 @@
// cmpout
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue6964.go b/test/fixedbugs/issue6964.go
index 8f4b60d..7ad8336 100644
--- a/test/fixedbugs/issue6964.go
+++ b/test/fixedbugs/issue6964.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue7044.go b/test/fixedbugs/issue7044.go
index cac6a76..00c78c8 100644
--- a/test/fixedbugs/issue7044.go
+++ b/test/fixedbugs/issue7044.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7050.go b/test/fixedbugs/issue7050.go
index e58b684..be7a118 100644
--- a/test/fixedbugs/issue7050.go
+++ b/test/fixedbugs/issue7050.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7150.go b/test/fixedbugs/issue7150.go
index 264958a..8a8a7d0 100644
--- a/test/fixedbugs/issue7150.go
+++ b/test/fixedbugs/issue7150.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
@@ -9,9 +9,9 @@
package main
func main() {
- _ = [0]int{-1: 50} // ERROR "array index must be non-negative integer constant"
- _ = [0]int{0: 0} // ERROR "array index 0 out of bounds \[0:0\]"
- _ = [0]int{5: 25} // ERROR "array index 5 out of bounds \[0:0\]"
- _ = [10]int{2: 10, 15: 30} // ERROR "array index 15 out of bounds \[0:10\]"
- _ = [10]int{5: 5, 1: 1, 12: 12} // ERROR "array index 12 out of bounds \[0:10\]"
+ _ = [0]int{-1: 50} // ERROR "index must be non-negative integer constant"
+ _ = [0]int{0: 0} // ERROR "index 0 out of bounds \[0:0\]"
+ _ = [0]int{5: 25} // ERROR "index 5 out of bounds \[0:0\]"
+ _ = [10]int{2: 10, 15: 30} // ERROR "index 15 out of bounds \[0:10\]"
+ _ = [10]int{5: 5, 1: 1, 12: 12} // ERROR "index 12 out of bounds \[0:10\]"
}
diff --git a/test/fixedbugs/issue7153.go b/test/fixedbugs/issue7153.go
index d70d858..f238f78 100644
--- a/test/fixedbugs/issue7153.go
+++ b/test/fixedbugs/issue7153.go
@@ -8,4 +8,4 @@
package p
-var _ = []int{a: true, true} // ERROR "undefined: a" "cannot use true \(type bool\) as type int in array element"
+var _ = []int{a: true, true} // ERROR "undefined: a" "cannot use true \(type bool\) as type int in array or slice literal"
diff --git a/test/fixedbugs/issue7223.go b/test/fixedbugs/issue7223.go
index c5955d5..0ec3476 100644
--- a/test/fixedbugs/issue7223.go
+++ b/test/fixedbugs/issue7223.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7272.go b/test/fixedbugs/issue7272.go
index 97a08da..b10a8bf 100644
--- a/test/fixedbugs/issue7272.go
+++ b/test/fixedbugs/issue7272.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/fixedbugs/issue7310.go b/test/fixedbugs/issue7310.go
index 4a535a1..1169fcf 100644
--- a/test/fixedbugs/issue7310.go
+++ b/test/fixedbugs/issue7310.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7316.go b/test/fixedbugs/issue7316.go
index 4b32261..0734641 100644
--- a/test/fixedbugs/issue7316.go
+++ b/test/fixedbugs/issue7316.go
@@ -1,6 +1,6 @@
// runoutput
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7346.go b/test/fixedbugs/issue7346.go
index dd5ea22..21fab2d 100644
--- a/test/fixedbugs/issue7346.go
+++ b/test/fixedbugs/issue7346.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7366.go b/test/fixedbugs/issue7366.go
index 754da6f..a6b786f 100644
--- a/test/fixedbugs/issue7366.go
+++ b/test/fixedbugs/issue7366.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7590.go b/test/fixedbugs/issue7590.go
index e283832..607a3ae 100644
--- a/test/fixedbugs/issue7590.go
+++ b/test/fixedbugs/issue7590.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7690.go b/test/fixedbugs/issue7690.go
index 4ad9e86..fea2aa1 100644
--- a/test/fixedbugs/issue7690.go
+++ b/test/fixedbugs/issue7690.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7794.go b/test/fixedbugs/issue7794.go
index 1e303bd..f31de94 100644
--- a/test/fixedbugs/issue7794.go
+++ b/test/fixedbugs/issue7794.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7863.go b/test/fixedbugs/issue7863.go
index 97f2255..da2ed05 100644
--- a/test/fixedbugs/issue7863.go
+++ b/test/fixedbugs/issue7863.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7867.go b/test/fixedbugs/issue7867.go
index 9f28a71..166506e 100644
--- a/test/fixedbugs/issue7867.go
+++ b/test/fixedbugs/issue7867.go
@@ -1,6 +1,6 @@
// runoutput
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7884.go b/test/fixedbugs/issue7884.go
index 497e261..ab7a858 100644
--- a/test/fixedbugs/issue7884.go
+++ b/test/fixedbugs/issue7884.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7944.go b/test/fixedbugs/issue7944.go
index 9e5bed1..960065b 100644
--- a/test/fixedbugs/issue7944.go
+++ b/test/fixedbugs/issue7944.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7995.go b/test/fixedbugs/issue7995.go
index 05f1168..af77a6d 100644
--- a/test/fixedbugs/issue7995.go
+++ b/test/fixedbugs/issue7995.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7995b.dir/x1.go b/test/fixedbugs/issue7995b.dir/x1.go
index 075911b..bafecf5 100644
--- a/test/fixedbugs/issue7995b.dir/x1.go
+++ b/test/fixedbugs/issue7995b.dir/x1.go
@@ -4,12 +4,8 @@
var P int
-var b bool
-
+//go:noinline
func F(x *int) string {
- if b { // avoid inlining
- F(x)
- }
P = 50
*x = 100
return fmt.Sprintln(P, *x)
diff --git a/test/fixedbugs/issue7996.go b/test/fixedbugs/issue7996.go
index 98289eb..1ee6fc7 100644
--- a/test/fixedbugs/issue7996.go
+++ b/test/fixedbugs/issue7996.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7997.go b/test/fixedbugs/issue7997.go
index 10c5262..a342189 100644
--- a/test/fixedbugs/issue7997.go
+++ b/test/fixedbugs/issue7997.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue7998.go b/test/fixedbugs/issue7998.go
index 245035e..8da39e8 100644
--- a/test/fixedbugs/issue7998.go
+++ b/test/fixedbugs/issue7998.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8004.go b/test/fixedbugs/issue8004.go
index 37e2fe0..548ee1c 100644
--- a/test/fixedbugs/issue8004.go
+++ b/test/fixedbugs/issue8004.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8011.go b/test/fixedbugs/issue8011.go
index b966174..57af2a9 100644
--- a/test/fixedbugs/issue8011.go
+++ b/test/fixedbugs/issue8011.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8017.go b/test/fixedbugs/issue8017.go
index 22056e0..9afcdf0 100644
--- a/test/fixedbugs/issue8017.go
+++ b/test/fixedbugs/issue8017.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8028.go b/test/fixedbugs/issue8028.go
index 7ceb902..9f2649a 100644
--- a/test/fixedbugs/issue8028.go
+++ b/test/fixedbugs/issue8028.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8036.go b/test/fixedbugs/issue8036.go
index f32fde8..82ba7f7 100644
--- a/test/fixedbugs/issue8036.go
+++ b/test/fixedbugs/issue8036.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
@@ -18,19 +18,19 @@
type TI [3]uintptr
+//go:noinline
func G() (t TI) {
t[0] = 1
t[1] = 2
t[2] = 3
- runtime.GC() // prevent inlining
return
}
+//go:noinline
func F() (t T) {
t.X = newint()
t.Y = t.X
t.Z = t.Y
- runtime.GC() // prevent inlining
return
}
diff --git a/test/fixedbugs/issue8039.go b/test/fixedbugs/issue8039.go
index b13e474..ee00c60 100644
--- a/test/fixedbugs/issue8039.go
+++ b/test/fixedbugs/issue8039.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8047.go b/test/fixedbugs/issue8047.go
index fe7ada5..5ac4a0e 100644
--- a/test/fixedbugs/issue8047.go
+++ b/test/fixedbugs/issue8047.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8047b.go b/test/fixedbugs/issue8047b.go
index de6acaa..df902a5 100644
--- a/test/fixedbugs/issue8047b.go
+++ b/test/fixedbugs/issue8047b.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8048.go b/test/fixedbugs/issue8048.go
index a7984c4..577f606 100644
--- a/test/fixedbugs/issue8048.go
+++ b/test/fixedbugs/issue8048.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8073.go b/test/fixedbugs/issue8073.go
index 6601221..d47481c 100644
--- a/test/fixedbugs/issue8073.go
+++ b/test/fixedbugs/issue8073.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8074.go b/test/fixedbugs/issue8074.go
index aedab24..604a4f9 100644
--- a/test/fixedbugs/issue8074.go
+++ b/test/fixedbugs/issue8074.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8076.go b/test/fixedbugs/issue8076.go
index ad89067..543ccc1 100644
--- a/test/fixedbugs/issue8076.go
+++ b/test/fixedbugs/issue8076.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8132.go b/test/fixedbugs/issue8132.go
index 52f5d39..b28a84c 100644
--- a/test/fixedbugs/issue8132.go
+++ b/test/fixedbugs/issue8132.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8139.go b/test/fixedbugs/issue8139.go
index 821c9ff..6e5607d 100644
--- a/test/fixedbugs/issue8139.go
+++ b/test/fixedbugs/issue8139.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8154.go b/test/fixedbugs/issue8154.go
index 92c3cac..3ffad34 100644
--- a/test/fixedbugs/issue8154.go
+++ b/test/fixedbugs/issue8154.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue8155.go b/test/fixedbugs/issue8155.go
index c611f6c..56a6738 100644
--- a/test/fixedbugs/issue8155.go
+++ b/test/fixedbugs/issue8155.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8158.go b/test/fixedbugs/issue8158.go
index b110de1..150b338 100644
--- a/test/fixedbugs/issue8158.go
+++ b/test/fixedbugs/issue8158.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8183.go b/test/fixedbugs/issue8183.go
index 7104f1e..f23e660 100644
--- a/test/fixedbugs/issue8183.go
+++ b/test/fixedbugs/issue8183.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue8311.go b/test/fixedbugs/issue8311.go
index dd92856..375b480 100644
--- a/test/fixedbugs/issue8311.go
+++ b/test/fixedbugs/issue8311.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8325.go b/test/fixedbugs/issue8325.go
index e22fd31..6b0fc25 100644
--- a/test/fixedbugs/issue8325.go
+++ b/test/fixedbugs/issue8325.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8336.go b/test/fixedbugs/issue8336.go
index 26bdeab..419fdf1 100644
--- a/test/fixedbugs/issue8336.go
+++ b/test/fixedbugs/issue8336.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8347.go b/test/fixedbugs/issue8347.go
index 0828ccf..6394a95 100644
--- a/test/fixedbugs/issue8347.go
+++ b/test/fixedbugs/issue8347.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8475.go b/test/fixedbugs/issue8475.go
index e697945..5b22067 100644
--- a/test/fixedbugs/issue8475.go
+++ b/test/fixedbugs/issue8475.go
@@ -1,6 +1,6 @@
// build
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8507.go b/test/fixedbugs/issue8507.go
index 00a14aa..ad6ba8a 100644
--- a/test/fixedbugs/issue8507.go
+++ b/test/fixedbugs/issue8507.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8612.go b/test/fixedbugs/issue8612.go
index 93370cf..2a622f4 100644
--- a/test/fixedbugs/issue8612.go
+++ b/test/fixedbugs/issue8612.go
@@ -1,6 +1,6 @@
//compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8613.go b/test/fixedbugs/issue8613.go
new file mode 100644
index 0000000..c0ad131
--- /dev/null
+++ b/test/fixedbugs/issue8613.go
@@ -0,0 +1,39 @@
+// +build amd64
+// run
+
+// Copyright 2016 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 main
+
+var out int
+var zero int
+
+func main() {
+ wantPanic("test1", func() {
+ out = 1 / zero
+ })
+ wantPanic("test2", func() {
+ _ = 1 / zero
+ })
+ wantPanic("test3", func() {
+ v := 0
+ _ = 1 / v
+ })
+ wantPanic("test4", func() { divby(0) })
+}
+
+func wantPanic(test string, fn func()) {
+ defer func() {
+ if e := recover(); e == nil {
+ panic(test + ": expected panic")
+ }
+ }()
+ fn()
+}
+
+//go:noinline
+func divby(v int) {
+ _ = 1 / v
+}
diff --git a/test/fixedbugs/issue8620.go b/test/fixedbugs/issue8620.go
index 30d7a82..4754604 100644
--- a/test/fixedbugs/issue8620.go
+++ b/test/fixedbugs/issue8620.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8745.go b/test/fixedbugs/issue8745.go
index f3a70af..fee2ca7 100644
--- a/test/fixedbugs/issue8745.go
+++ b/test/fixedbugs/issue8745.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue8761.go b/test/fixedbugs/issue8761.go
index badf639..7f458f7 100644
--- a/test/fixedbugs/issue8761.go
+++ b/test/fixedbugs/issue8761.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8836.go b/test/fixedbugs/issue8836.go
index 92c18f6..039b9c7 100644
--- a/test/fixedbugs/issue8836.go
+++ b/test/fixedbugs/issue8836.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/fixedbugs/issue887.go b/test/fixedbugs/issue887.go
index 5bc193b..b68ba69 100644
--- a/test/fixedbugs/issue887.go
+++ b/test/fixedbugs/issue887.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/fixedbugs/issue8947.go b/test/fixedbugs/issue8947.go
index f40c02e..703207d 100644
--- a/test/fixedbugs/issue8947.go
+++ b/test/fixedbugs/issue8947.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue8961.go b/test/fixedbugs/issue8961.go
index fbfb7e6..22b0f04 100644
--- a/test/fixedbugs/issue8961.go
+++ b/test/fixedbugs/issue8961.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9006.go b/test/fixedbugs/issue9006.go
index c559f58..a61574b 100644
--- a/test/fixedbugs/issue9006.go
+++ b/test/fixedbugs/issue9006.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9017.go b/test/fixedbugs/issue9017.go
index e19bac2..5659785 100644
--- a/test/fixedbugs/issue9017.go
+++ b/test/fixedbugs/issue9017.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9036.go b/test/fixedbugs/issue9036.go
index 283159e..75ffb2d 100644
--- a/test/fixedbugs/issue9036.go
+++ b/test/fixedbugs/issue9036.go
@@ -1,10 +1,10 @@
// errorcheck
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
-// Expects to see error messages on "p" exponents.
+// Expects to see error messages on 'p' exponents.
package main
@@ -14,11 +14,19 @@
x1 = 1.1 // float
x2 = 1e10 // float
x3 = 0x1e10 // integer (e is a hex digit)
- x4 = 0x1p10 // ERROR "malformed floating point constant"
- x5 = 1p10 // ERROR "malformed floating point constant"
- x6 = 0p0 // ERROR "malformed floating point constant"
)
+// 'p' exponents are invalid - the 'p' is not considered
+// part of a floating-point number, but introduces a new
+// (unexpected) name.
+//
+// Error recovery is not ideal and we use a new declaration
+// each time for the parser to recover.
+
+const x4 = 0x1p10 // ERROR "unexpected p10"
+const x5 = 1p10 // ERROR "unexpected p10"
+const x6 = 0p0 // ERROR "unexpected p0"
+
func main() {
fmt.Printf("%g %T\n", x1, x1)
fmt.Printf("%g %T\n", x2, x2)
diff --git a/test/fixedbugs/issue9076.go b/test/fixedbugs/issue9076.go
index ad1cd5d..8daf12f 100644
--- a/test/fixedbugs/issue9076.go
+++ b/test/fixedbugs/issue9076.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9083.go b/test/fixedbugs/issue9083.go
index c92c0a6..8fbd78b 100644
--- a/test/fixedbugs/issue9083.go
+++ b/test/fixedbugs/issue9083.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9110.go b/test/fixedbugs/issue9110.go
index b9e861f..086be77 100644
--- a/test/fixedbugs/issue9110.go
+++ b/test/fixedbugs/issue9110.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9321.go b/test/fixedbugs/issue9321.go
index e850d8f..2b2807a 100644
--- a/test/fixedbugs/issue9321.go
+++ b/test/fixedbugs/issue9321.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9355.go b/test/fixedbugs/issue9355.go
index 40c9ba9..10f8c73 100644
--- a/test/fixedbugs/issue9355.go
+++ b/test/fixedbugs/issue9355.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9432.go b/test/fixedbugs/issue9432.go
index 0d0bc96..2049460 100644
--- a/test/fixedbugs/issue9432.go
+++ b/test/fixedbugs/issue9432.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9731.go b/test/fixedbugs/issue9731.go
index 286cebd..9237d65 100644
--- a/test/fixedbugs/issue9731.go
+++ b/test/fixedbugs/issue9731.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/fixedbugs/issue9862.go b/test/fixedbugs/issue9862.go
index 692a60d..3572512 100644
--- a/test/fixedbugs/issue9862.go
+++ b/test/fixedbugs/issue9862.go
@@ -1,6 +1,6 @@
// skip
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/float_lit2.go b/test/float_lit2.go
index 96d23f3..bb86559 100644
--- a/test/float_lit2.go
+++ b/test/float_lit2.go
@@ -2,7 +2,7 @@
// Check conversion of constant to float32/float64 near min/max boundaries.
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/float_lit3.go b/test/float_lit3.go
index 43dca9c..c4d1aa5 100644
--- a/test/float_lit3.go
+++ b/test/float_lit3.go
@@ -2,7 +2,7 @@
// Check flagging of invalid conversion of constant to float32/float64 near min/max boundaries.
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/func6.go b/test/func6.go
index d1b7f46..5b2f9f2 100644
--- a/test/func6.go
+++ b/test/func6.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/func7.go b/test/func7.go
index feb7c20..3b22199 100644
--- a/test/func7.go
+++ b/test/func7.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/func8.go b/test/func8.go
index 1305180..9de01d4 100644
--- a/test/func8.go
+++ b/test/func8.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -21,16 +21,14 @@
var xy string
+//go:noinline
func x() bool {
- for false {
- } // no inlining
xy += "x"
return false
}
+//go:noinline
func y() string {
- for false {
- } // no inlining
xy += "y"
return "abc"
}
diff --git a/test/funcdup.go b/test/funcdup.go
index d15d685..7b05d12 100644
--- a/test/funcdup.go
+++ b/test/funcdup.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/funcdup2.go b/test/funcdup2.go
index 1db1a39..9513ef4 100644
--- a/test/funcdup2.go
+++ b/test/funcdup2.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/gc2.go b/test/gc2.go
index b33a027..31b36d8 100644
--- a/test/gc2.go
+++ b/test/gc2.go
@@ -1,7 +1,7 @@
// +build !nacl
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/gcstring.go b/test/gcstring.go
index 627a426..7633d5d 100644
--- a/test/gcstring.go
+++ b/test/gcstring.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/goprint.go b/test/goprint.go
index cdaccf4..0648c77 100644
--- a/test/goprint.go
+++ b/test/goprint.go
@@ -1,6 +1,6 @@
// cmpout
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -8,9 +8,14 @@
package main
-import "time"
+import (
+ "runtime"
+ "time"
+)
func main() {
go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255))
- time.Sleep(100*time.Millisecond)
+ for runtime.NumGoroutine() > 1 {
+ time.Sleep(10*time.Millisecond)
+ }
}
diff --git a/test/goto.go b/test/goto.go
index ca477b3..f456901 100644
--- a/test/goto.go
+++ b/test/goto.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -40,7 +40,7 @@
// goto across declaration not okay
func _() {
goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
- x := 1 // GCCGO_ERROR "defined here"
+ x := 1 // GCCGO_ERROR "defined here"
_ = x
L:
}
@@ -62,7 +62,7 @@
x := 1
_ = x
}
- x := 1 // GCCGO_ERROR "defined here"
+ x := 1 // GCCGO_ERROR "defined here"
_ = x
L:
}
@@ -78,7 +78,7 @@
// error shows first offending variable
func _() {
goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
- x := 1 // GCCGO_ERROR "defined here"
+ x := 1 // GCCGO_ERROR "defined here"
_ = x
y := 1
_ = y
@@ -88,7 +88,7 @@
// goto not okay even if code path is dead
func _() {
goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
- x := 1 // GCCGO_ERROR "defined here"
+ x := 1 // GCCGO_ERROR "defined here"
_ = x
y := 1
_ = y
@@ -115,14 +115,14 @@
// goto into inner block not okay
func _() {
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
- { // GCCGO_ERROR "block starts here"
+ { // GCCGO_ERROR "block starts here"
L:
}
}
// goto backward into inner block still not okay
func _() {
- { // GCCGO_ERROR "block starts here"
+ { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
@@ -133,7 +133,7 @@
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
{
{
- { // GCCGO_ERROR "block starts here"
+ { // GCCGO_ERROR "block starts here"
L:
}
}
@@ -145,7 +145,7 @@
goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block"
x := 1
_ = x
- { // GCCGO_ERROR "block starts here"
+ { // GCCGO_ERROR "block starts here"
L:
}
}
@@ -179,15 +179,15 @@
}
func _() {
- goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
- if true { // GCCGO_ERROR "block starts here"
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ if true { // GCCGO_ERROR "block starts here"
L:
}
}
func _() {
- goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
- if true { // GCCGO_ERROR "block starts here"
+ goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+ if true { // GCCGO_ERROR "block starts here"
L:
} else {
}
@@ -196,13 +196,13 @@
func _() {
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
if true {
- } else { // GCCGO_ERROR "block starts here"
+ } else { // GCCGO_ERROR "block starts here"
L:
}
}
func _() {
- if false { // GCCGO_ERROR "block starts here"
+ if false { // GCCGO_ERROR "block starts here"
L:
} else {
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
@@ -212,7 +212,7 @@
func _() {
if true {
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
- } else { // GCCGO_ERROR "block starts here"
+ } else { // GCCGO_ERROR "block starts here"
L:
}
}
@@ -220,7 +220,7 @@
func _() {
if true {
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
- } else if false { // GCCGO_ERROR "block starts here"
+ } else if false { // GCCGO_ERROR "block starts here"
L:
}
}
@@ -228,7 +228,7 @@
func _() {
if true {
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
- } else if false { // GCCGO_ERROR "block starts here"
+ } else if false { // GCCGO_ERROR "block starts here"
L:
} else {
}
@@ -243,7 +243,7 @@
if true {
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
} else if false {
- } else { // GCCGO_ERROR "block starts here"
+ } else { // GCCGO_ERROR "block starts here"
L:
}
}
@@ -287,14 +287,14 @@
}
func _() {
- for { // GCCGO_ERROR "block starts here"
+ for { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
}
func _() {
- for { // GCCGO_ERROR "block starts here"
+ for { // GCCGO_ERROR "block starts here"
goto L
L1:
}
@@ -303,42 +303,42 @@
}
func _() {
- for i < n { // GCCGO_ERROR "block starts here"
+ for i < n { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
}
func _() {
- for i = 0; i < n; i++ { // GCCGO_ERROR "block starts here"
+ for i = 0; i < n; i++ { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
}
func _() {
- for i = range x { // GCCGO_ERROR "block starts here"
+ for i = range x { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
}
func _() {
- for i = range c { // GCCGO_ERROR "block starts here"
+ for i = range c { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
}
func _() {
- for i = range m { // GCCGO_ERROR "block starts here"
+ for i = range m { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
}
func _() {
- for i = range s { // GCCGO_ERROR "block starts here"
+ for i = range s { // GCCGO_ERROR "block starts here"
L:
}
goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
@@ -398,7 +398,7 @@
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
switch i {
case 0:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
}
}
@@ -406,7 +406,7 @@
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
switch i {
case 0:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
;
default:
}
@@ -417,7 +417,7 @@
switch i {
case 0:
default:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
}
}
@@ -426,14 +426,14 @@
default:
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
case 0:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
}
}
func _() {
switch i {
case 0:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
;
default:
goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
@@ -495,7 +495,7 @@
goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block"
select {
case c <- 1:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
}
}
@@ -503,7 +503,7 @@
goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block"
select {
case c <- 1:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
;
default:
}
@@ -514,7 +514,7 @@
select {
case <-c:
default:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
}
}
@@ -523,14 +523,14 @@
default:
goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
case <-c:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
}
}
func _() {
select {
case <-c:
- L: // GCCGO_ERROR "block starts here"
+ L: // GCCGO_ERROR "block starts here"
;
default:
goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
diff --git a/test/heapsampling.go b/test/heapsampling.go
new file mode 100644
index 0000000..c00b866
--- /dev/null
+++ b/test/heapsampling.go
@@ -0,0 +1,172 @@
+// run
+
+// Copyright 2009 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.
+
+// Test heap sampling logic.
+
+package main
+
+import (
+ "fmt"
+ "math"
+ "runtime"
+)
+
+var a16 *[16]byte
+var a512 *[512]byte
+var a256 *[256]byte
+var a1k *[1024]byte
+var a64k *[64 * 1024]byte
+
+// This test checks that heap sampling produces reasonable
+// results. Note that heap sampling uses randomization, so the results
+// vary for run to run. This test only checks that the resulting
+// values appear reasonable.
+func main() {
+ const countInterleaved = 10000
+ allocInterleaved(countInterleaved)
+ checkAllocations(getMemProfileRecords(), "main.allocInterleaved", countInterleaved, []int64{256 * 1024, 1024, 256 * 1024, 512, 256 * 1024, 256})
+
+ const count = 100000
+ alloc(count)
+ checkAllocations(getMemProfileRecords(), "main.alloc", count, []int64{1024, 512, 256})
+}
+
+// allocInterleaved stress-tests the heap sampling logic by
+// interleaving large and small allocations.
+func allocInterleaved(n int) {
+ for i := 0; i < n; i++ {
+ // Test verification depends on these lines being contiguous.
+ a64k = new([64 * 1024]byte)
+ a1k = new([1024]byte)
+ a64k = new([64 * 1024]byte)
+ a512 = new([512]byte)
+ a64k = new([64 * 1024]byte)
+ a256 = new([256]byte)
+ }
+}
+
+// alloc performs only small allocations for sanity testing.
+func alloc(n int) {
+ for i := 0; i < n; i++ {
+ // Test verification depends on these lines being contiguous.
+ a1k = new([1024]byte)
+ a512 = new([512]byte)
+ a256 = new([256]byte)
+ }
+}
+
+// checkAllocations validates that the profile records collected for
+// the named function are consistent with count contiguous allocations
+// of the specified sizes.
+func checkAllocations(records []runtime.MemProfileRecord, fname string, count int64, size []int64) {
+ a := allocObjects(records, fname)
+ firstLine := 0
+ for ln := range a {
+ if firstLine == 0 || firstLine > ln {
+ firstLine = ln
+ }
+ }
+ var totalcount int64
+ for i, w := range size {
+ ln := firstLine + i
+ s := a[ln]
+ checkValue(fname, ln, "objects", count, s.objects)
+ checkValue(fname, ln, "bytes", count*w, s.bytes)
+ totalcount += s.objects
+ }
+ // Check the total number of allocations, to ensure some sampling occurred.
+ if totalwant := count * int64(len(size)); totalcount <= 0 || totalcount > totalwant*1024 {
+ panic(fmt.Sprintf("%s want total count > 0 && <= %d, got %d", fname, totalwant*1024, totalcount))
+ }
+}
+
+// checkValue checks an unsampled value against a range.
+func checkValue(fname string, ln int, name string, want, got int64) {
+ if got < 0 || got > 1024*want {
+ panic(fmt.Sprintf("%s:%d want %s >= 0 && <= %d, got %d", fname, ln, name, 1024*want, got))
+ }
+}
+
+func getMemProfileRecords() []runtime.MemProfileRecord {
+ // Force the runtime to update the object and byte counts.
+ // This can take up to two GC cycles to get a complete
+ // snapshot of the current point in time.
+ runtime.GC()
+ runtime.GC()
+
+ // Find out how many records there are (MemProfile(nil, true)),
+ // allocate that many records, and get the data.
+ // There's a race—more records might be added between
+ // the two calls—so allocate a few extra records for safety
+ // and also try again if we're very unlucky.
+ // The loop should only execute one iteration in the common case.
+ var p []runtime.MemProfileRecord
+ n, ok := runtime.MemProfile(nil, true)
+ for {
+ // Allocate room for a slightly bigger profile,
+ // in case a few more entries have been added
+ // since the call to MemProfile.
+ p = make([]runtime.MemProfileRecord, n+50)
+ n, ok = runtime.MemProfile(p, true)
+ if ok {
+ p = p[0:n]
+ break
+ }
+ // Profile grew; try again.
+ }
+ return p
+}
+
+type allocStat struct {
+ bytes, objects int64
+}
+
+// allocObjects examines the profile records for the named function
+// and returns the allocation stats aggregated by source line number.
+func allocObjects(records []runtime.MemProfileRecord, function string) map[int]allocStat {
+ a := make(map[int]allocStat)
+ for _, r := range records {
+ for _, s := range r.Stack0 {
+ if s == 0 {
+ break
+ }
+ if f := runtime.FuncForPC(s); f != nil {
+ name := f.Name()
+ _, line := f.FileLine(s)
+ if name == function {
+ allocStat := a[line]
+ allocStat.bytes += r.AllocBytes
+ allocStat.objects += r.AllocObjects
+ a[line] = allocStat
+ }
+ }
+ }
+ }
+ for line, stats := range a {
+ objects, bytes := scaleHeapSample(stats.objects, stats.bytes, int64(runtime.MemProfileRate))
+ a[line] = allocStat{bytes, objects}
+ }
+ return a
+}
+
+// scaleHeapSample unsamples heap allocations.
+// Taken from src/cmd/pprof/internal/profile/legacy_profile.go
+func scaleHeapSample(count, size, rate int64) (int64, int64) {
+ if count == 0 || size == 0 {
+ return 0, 0
+ }
+
+ if rate <= 1 {
+ // if rate==1 all samples were collected so no adjustment is needed.
+ // if rate<1 treat as unknown and skip scaling.
+ return count, size
+ }
+
+ avgSize := float64(size) / float64(count)
+ scale := 1 / (1 - math.Exp(-avgSize/float64(rate)))
+
+ return int64(float64(count) * scale), int64(float64(size) * scale)
+}
diff --git a/test/import2.dir/import2.go b/test/import2.dir/import2.go
index 8bb1eb9..9c54a1b 100644
--- a/test/import2.dir/import2.go
+++ b/test/import2.dir/import2.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/import2.dir/import3.go b/test/import2.dir/import3.go
index d7fe37b..3bf9cb0 100644
--- a/test/import2.dir/import3.go
+++ b/test/import2.dir/import3.go
@@ -1,4 +1,4 @@
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/import2.go b/test/import2.go
index f8d0b0a..1ef1dd4 100644
--- a/test/import2.go
+++ b/test/import2.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/import4.dir/import4.go b/test/import4.dir/import4.go
index f92c663..b9f973f 100644
--- a/test/import4.dir/import4.go
+++ b/test/import4.dir/import4.go
@@ -18,7 +18,7 @@
import . "bufio" // ERROR "imported and not used.*bufio"
// again, package without anything in it
-import "./empty" // GC_ERROR "imported and not used.*empty"
-import Z "./empty" // GC_ERROR "imported and not used.*empty"
+import "./empty" // ERROR "imported and not used.*empty"
+import Z "./empty" // ERROR "imported and not used.*empty"
import . "./empty" // ERROR "imported and not used.*empty"
diff --git a/test/index.go b/test/index.go
index 9ff9e9f..d73d137 100644
--- a/test/index.go
+++ b/test/index.go
@@ -1,6 +1,6 @@
// skip
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/index0.go b/test/index0.go
index 04a1619..62f3392 100644
--- a/test/index0.go
+++ b/test/index0.go
@@ -1,6 +1,6 @@
// runoutput ./index.go
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/index1.go b/test/index1.go
index e28efa3..40efc54 100644
--- a/test/index1.go
+++ b/test/index1.go
@@ -1,6 +1,6 @@
// errorcheckoutput ./index.go
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/index2.go b/test/index2.go
index a7107cc..2a210cc 100644
--- a/test/index2.go
+++ b/test/index2.go
@@ -1,6 +1,6 @@
// errorcheckoutput ./index.go
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/init1.go b/test/init1.go
index 62dfb72..0803dce 100644
--- a/test/init1.go
+++ b/test/init1.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -40,7 +40,7 @@
sys1, numGC1 := memstats.Sys, memstats.NumGC
if sys1-sys >= N*MB || numGC1 == numGC {
println("allocated 1000 chunks of", MB, "and used ", sys1-sys, "memory")
- println("numGC went", numGC, "to", numGC)
+ println("numGC went", numGC, "to", numGC1)
panic("init1")
}
}
diff --git a/test/initloop.go b/test/initloop.go
new file mode 100644
index 0000000..d90395d
--- /dev/null
+++ b/test/initloop.go
@@ -0,0 +1,17 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that initialization loops are caught
+// and that the errors print correctly.
+
+package main
+
+var (
+ x int = a
+ a int = b // ERROR "a refers to\n.*b refers to\n.*c refers to\n.*a"
+ b int = c
+ c int = a
+)
diff --git a/test/inline.go b/test/inline.go
index 54f7b3e..773b047 100644
--- a/test/inline.go
+++ b/test/inline.go
@@ -1,6 +1,6 @@
// errorcheck -0 -m
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
@@ -22,3 +22,53 @@
func f(x *byte) *byte { // ERROR "can inline f" "leaking param: x to result"
return add2(x, 1) // ERROR "inlining call to add2" "inlining call to add1"
}
+
+//go:noinline
+func g(x int) int {
+ return x + 1
+}
+
+func h(x int) int { // ERROR "can inline h"
+ return x + 2
+}
+
+func i(x int) int { // ERROR "can inline i"
+ const y = 2
+ return x + y
+}
+
+func j(x int) int { // ERROR "can inline j"
+ switch {
+ case x > 0:
+ return x + 2
+ default:
+ return x + 1
+ }
+}
+
+// can't currently inline functions with a break statement
+func switchBreak(x, y int) int {
+ var n int
+ switch x {
+ case 0:
+ n = 1
+ Done:
+ switch y {
+ case 0:
+ n += 10
+ break Done
+ }
+ n = 2
+ }
+ return n
+}
+
+// can't currently inline functions with a type switch
+func switchType(x interface{}) int { // ERROR "switchType x does not escape"
+ switch x.(type) {
+ case int:
+ return x.(int)
+ default:
+ return 0
+ }
+}
diff --git a/test/interface/assertinline.go b/test/interface/assertinline.go
index faa848a..227fe70 100644
--- a/test/interface/assertinline.go
+++ b/test/interface/assertinline.go
@@ -1,6 +1,6 @@
// errorcheck -0 -d=typeassert
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/interface/noeq.go b/test/interface/noeq.go
index 1c5166e..bb36893 100644
--- a/test/interface/noeq.go
+++ b/test/interface/noeq.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/interface/recursive1.dir/recursive1.go b/test/interface/recursive1.dir/recursive1.go
index 441f0ec..8498cb5 100644
--- a/test/interface/recursive1.dir/recursive1.go
+++ b/test/interface/recursive1.dir/recursive1.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/interface/recursive1.dir/recursive2.go b/test/interface/recursive1.dir/recursive2.go
index e8048c6..29385df 100644
--- a/test/interface/recursive1.dir/recursive2.go
+++ b/test/interface/recursive1.dir/recursive2.go
@@ -1,4 +1,4 @@
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/interface/recursive1.go b/test/interface/recursive1.go
index 62f6108..ea2f4eb 100644
--- a/test/interface/recursive1.go
+++ b/test/interface/recursive1.go
@@ -1,6 +1,6 @@
// compiledir
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/intrinsic.dir/main.go b/test/intrinsic.dir/main.go
new file mode 100644
index 0000000..46e6cb3
--- /dev/null
+++ b/test/intrinsic.dir/main.go
@@ -0,0 +1,109 @@
+// Copyright 2016 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 main
+
+import (
+ "fmt"
+ T "runtime/internal/sys"
+)
+
+var A = []uint64{0x0102030405060708, 0x1122334455667788}
+var B = []uint64{0x0807060504030201, 0x8877665544332211}
+
+var errors int
+
+func logf(f string, args ...interface{}) {
+ errors++
+ fmt.Printf(f, args...)
+ if errors > 100 { // 100 is enough spewage
+ panic("100 errors is plenty is enough")
+ }
+}
+
+func test(i, x uint64) {
+ t := T.Ctz64(x) // ERROR "intrinsic substitution for Ctz64"
+ if i != t {
+ logf("Ctz64(0x%x) expected %d but got %d\n", x, i, t)
+ }
+ x = -x
+ t = T.Ctz64(x) // ERROR "intrinsic substitution for Ctz64"
+ if i != t {
+ logf("Ctz64(0x%x) expected %d but got %d\n", x, i, t)
+ }
+
+ if i <= 32 {
+ x32 := uint32(x)
+ t32 := T.Ctz32(x32) // ERROR "intrinsic substitution for Ctz32"
+ if uint32(i) != t32 {
+ logf("Ctz32(0x%x) expected %d but got %d\n", x32, i, t32)
+ }
+ x32 = -x32
+ t32 = T.Ctz32(x32) // ERROR "intrinsic substitution for Ctz32"
+ if uint32(i) != t32 {
+ logf("Ctz32(0x%x) expected %d but got %d\n", x32, i, t32)
+ }
+ }
+ if i <= 16 {
+ x16 := uint16(x)
+ t16 := T.Ctz16(x16) // ERROR "intrinsic substitution for Ctz16"
+ if uint16(i) != t16 {
+ logf("Ctz16(0x%x) expected %d but got %d\n", x16, i, t16)
+ }
+ x16 = -x16
+ t16 = T.Ctz16(x16) // ERROR "intrinsic substitution for Ctz16"
+ if uint16(i) != t16 {
+ logf("Ctz16(0x%x) expected %d but got %d\n", x16, i, t16)
+ }
+ }
+}
+
+func main() {
+ // Test Bswap first because the other test relies on it
+ // working correctly (to implement bit reversal).
+ for i := range A {
+ x := A[i]
+ y := B[i]
+ X := T.Bswap64(x) // ERROR "intrinsic substitution for Bswap64"
+ Y := T.Bswap64(y) // ERROR "intrinsic substitution for Bswap64"
+ if y != X {
+ logf("Bswap64(0x%08x) expected 0x%08x but got 0x%08x\n", x, y, X)
+ }
+ if x != Y {
+ logf("Bswap64(0x%08x) expected 0x%08x but got 0x%08x\n", y, x, Y)
+ }
+
+ x32 := uint32(X)
+ y32 := uint32(Y >> 32)
+
+ X32 := T.Bswap32(x32) // ERROR "intrinsic substitution for Bswap32"
+ Y32 := T.Bswap32(y32) // ERROR "intrinsic substitution for Bswap32"
+ if y32 != X32 {
+ logf("Bswap32(0x%08x) expected 0x%08x but got 0x%08x\n", x32, y32, X32)
+ }
+ if x32 != Y32 {
+ logf("Bswap32(0x%08x) expected 0x%08x but got 0x%08x\n", y32, x32, Y32)
+ }
+ }
+
+ // Zero is a special case, be sure it is done right.
+ if T.Ctz16(0) != 16 { // ERROR "intrinsic substitution for Ctz16"
+ logf("ctz16(0) != 16")
+ }
+ if T.Ctz32(0) != 32 { // ERROR "intrinsic substitution for Ctz32"
+ logf("ctz32(0) != 32")
+ }
+ if T.Ctz64(0) != 64 { // ERROR "intrinsic substitution for Ctz64"
+ logf("ctz64(0) != 64")
+ }
+
+ for i := uint64(0); i <= 64; i++ {
+ for j := uint64(1); j <= 255; j += 2 {
+ for k := uint64(1); k <= 65537; k += 128 {
+ x := (j * k) << i
+ test(i, x)
+ }
+ }
+ }
+}
diff --git a/test/intrinsic.go b/test/intrinsic.go
new file mode 100644
index 0000000..f774128
--- /dev/null
+++ b/test/intrinsic.go
@@ -0,0 +1,8 @@
+// errorcheckandrundir -0 -d=ssa/intrinsics/debug
+// +build !ppc64,!ppc64le,amd64
+
+// Copyright 2016 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 ignored
diff --git a/test/ken/embed.go b/test/ken/embed.go
index 9b35c56..f7ca066 100644
--- a/test/ken/embed.go
+++ b/test/ken/embed.go
@@ -253,7 +253,7 @@
panic("fail")
}
- // run it thru an interface
+ // run it through an interface
i = s
s = i.(*S)
diff --git a/test/label.go b/test/label.go
index b30c27e..11716cc 100644
--- a/test/label.go
+++ b/test/label.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
@@ -17,8 +17,7 @@
for {
}
L2: // ERROR "label .*L2.* defined and not used"
- select {
- }
+ select {}
L3: // ERROR "label .*L3.* defined and not used"
switch {
}
@@ -59,4 +58,8 @@
default:
break L10
}
+
+ goto L10
+
+ goto go2 // ERROR "label go2 not defined"
}
diff --git a/test/label1.go b/test/label1.go
index f923a18..bdd489f 100644
--- a/test/label1.go
+++ b/test/label1.go
@@ -1,10 +1,9 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
-
// Verify that erroneous labels are caught by the compiler.
// This set is caught by pass 2. That's why this file is label1.go.
// Does not compile.
@@ -32,11 +31,17 @@
break L2
}
if x == 1 {
- continue L2 // ERROR "invalid continue label .*L2"
+ continue L2 // ERROR "invalid continue label .*L2|continue is not in a loop"
}
goto L2
}
+ for {
+ if x == 1 {
+ continue L2 // ERROR "invalid continue label .*L2"
+ }
+ }
+
L3:
switch {
case x > 10:
@@ -44,7 +49,7 @@
break L3
}
if x == 12 {
- continue L3 // ERROR "invalid continue label .*L3"
+ continue L3 // ERROR "invalid continue label .*L3|continue is not in a loop"
}
goto L3
}
@@ -55,7 +60,7 @@
break L4 // ERROR "invalid break label .*L4"
}
if x == 14 {
- continue L4 // ERROR "invalid continue label .*L4"
+ continue L4 // ERROR "invalid continue label .*L4|continue is not in a loop"
}
if x == 15 {
goto L4
@@ -68,7 +73,7 @@
break L5 // ERROR "invalid break label .*L5"
}
if x == 17 {
- continue L5 // ERROR "invalid continue label .*L5"
+ continue L5 // ERROR "invalid continue label .*L5|continue is not in a loop"
}
if x == 18 {
goto L5
@@ -85,4 +90,21 @@
goto L1
}
}
+
+ continue // ERROR "continue is not in a loop"
+ for {
+ continue on // ERROR "continue label not defined: on"
+ }
+
+ break // ERROR "break is not in a loop"
+ for {
+ break dance // ERROR "break label not defined: dance"
+ }
+
+ for {
+ switch x {
+ case 1:
+ continue
+ }
+ }
}
diff --git a/test/linkmain.go b/test/linkmain.go
new file mode 100644
index 0000000..af20ca5
--- /dev/null
+++ b/test/linkmain.go
@@ -0,0 +1,12 @@
+// +build ignore
+
+// Copyright 2015 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.
+
+// For linkmain_run.go.
+
+package notmain
+
+func main() {
+}
diff --git a/test/linkmain_run.go b/test/linkmain_run.go
new file mode 100644
index 0000000..55de481
--- /dev/null
+++ b/test/linkmain_run.go
@@ -0,0 +1,66 @@
+// +build !nacl
+// run
+
+// 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.
+
+// Run the sinit test.
+
+package main
+
+import (
+ "fmt"
+ "os"
+ "os/exec"
+ "strings"
+)
+
+func cleanup() {
+ os.Remove("linkmain.o")
+ os.Remove("linkmain.a")
+ os.Remove("linkmain1.o")
+ os.Remove("linkmain1.a")
+ os.Remove("linkmain.exe")
+}
+
+func run(cmdline string) {
+ args := strings.Fields(cmdline)
+ cmd := exec.Command(args[0], args[1:]...)
+ out, err := cmd.CombinedOutput()
+ if err != nil {
+ fmt.Printf("$ %s\n", cmdline)
+ fmt.Println(string(out))
+ fmt.Println(err)
+ cleanup()
+ os.Exit(1)
+ }
+}
+
+func runFail(cmdline string) {
+ args := strings.Fields(cmdline)
+ cmd := exec.Command(args[0], args[1:]...)
+ out, err := cmd.CombinedOutput()
+ if err == nil {
+ fmt.Printf("$ %s\n", cmdline)
+ fmt.Println(string(out))
+ fmt.Println("SHOULD HAVE FAILED!")
+ cleanup()
+ os.Exit(1)
+ }
+}
+
+func main() {
+ // helloworld.go is package main
+ run("go tool compile -o linkmain.o helloworld.go")
+ run("go tool compile -pack -o linkmain.a helloworld.go")
+ run("go tool link -o linkmain.exe linkmain.o")
+ run("go tool link -o linkmain.exe linkmain.a")
+
+ // linkmain.go is not
+ run("go tool compile -o linkmain1.o linkmain.go")
+ run("go tool compile -pack -o linkmain1.a linkmain.go")
+ runFail("go tool link -o linkmain.exe linkmain1.o")
+ runFail("go tool link -o linkmain.exe linkmain1.a")
+ cleanup()
+}
diff --git a/test/linkobj.go b/test/linkobj.go
new file mode 100644
index 0000000..8a86aa8
--- /dev/null
+++ b/test/linkobj.go
@@ -0,0 +1,155 @@
+// +build !nacl
+// run
+
+// Copyright 2016 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.
+
+// Test the compiler -linkobj flag.
+
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "strings"
+)
+
+var pwd, tmpdir string
+
+func main() {
+ dir, err := ioutil.TempDir("", "go-test-linkobj-")
+ if err != nil {
+ log.Fatal(err)
+ }
+ pwd, err = os.Getwd()
+ if err != nil {
+ log.Fatal(err)
+ }
+ if err := os.Chdir(dir); err != nil {
+ os.RemoveAll(dir)
+ log.Fatal(err)
+ }
+ tmpdir = dir
+
+ writeFile("p1.go", `
+ package p1
+
+ func F() {
+ println("hello from p1")
+ }
+ `)
+ writeFile("p2.go", `
+ package p2
+
+ import "./p1"
+
+ func F() {
+ p1.F()
+ println("hello from p2")
+ }
+
+ func main() {}
+ `)
+ writeFile("p3.go", `
+ package main
+
+ import "./p2"
+
+ func main() {
+ p2.F()
+ println("hello from main")
+ }
+ `)
+
+ // two rounds: once using normal objects, again using .a files (compile -pack).
+ for round := 0; round < 2; round++ {
+ pkg := "-pack=" + fmt.Sprint(round)
+
+ // The compiler expects the files being read to have the right suffix.
+ o := "o"
+ if round == 1 {
+ o = "a"
+ }
+
+ // inlining is disabled to make sure that the link objects contain needed code.
+ run("go", "tool", "compile", pkg, "-D", ".", "-I", ".", "-l", "-o", "p1."+o, "-linkobj", "p1.lo", "p1.go")
+ run("go", "tool", "compile", pkg, "-D", ".", "-I", ".", "-l", "-o", "p2."+o, "-linkobj", "p2.lo", "p2.go")
+ run("go", "tool", "compile", pkg, "-D", ".", "-I", ".", "-l", "-o", "p3."+o, "-linkobj", "p3.lo", "p3.go")
+
+ cp("p1."+o, "p1.oo")
+ cp("p2."+o, "p2.oo")
+ cp("p3."+o, "p3.oo")
+ cp("p1.lo", "p1."+o)
+ cp("p2.lo", "p2."+o)
+ cp("p3.lo", "p3."+o)
+ out := runFail("go", "tool", "link", "p2."+o)
+ if !strings.Contains(out, "not package main") {
+ fatalf("link p2.o failed but not for package main:\n%s", out)
+ }
+
+ run("go", "tool", "link", "-L", ".", "-o", "a.out.exe", "p3."+o)
+ out = run("./a.out.exe")
+ if !strings.Contains(out, "hello from p1\nhello from p2\nhello from main\n") {
+ fatalf("running main, incorrect output:\n%s", out)
+ }
+
+ // ensure that mistaken future round can't use these
+ os.Remove("p1.o")
+ os.Remove("a.out.exe")
+ }
+
+ cleanup()
+}
+
+func run(args ...string) string {
+ out, err := exec.Command(args[0], args[1:]...).CombinedOutput()
+ if err != nil {
+ fatalf("run %v: %s\n%s", args, err, out)
+ }
+ return string(out)
+}
+
+func runFail(args ...string) string {
+ out, err := exec.Command(args[0], args[1:]...).CombinedOutput()
+ if err == nil {
+ fatalf("runFail %v: unexpected success!\n%s", args, err, out)
+ }
+ return string(out)
+}
+
+func cp(src, dst string) {
+ data, err := ioutil.ReadFile(src)
+ if err != nil {
+ fatalf("%v", err)
+ }
+ err = ioutil.WriteFile(dst, data, 0666)
+ if err != nil {
+ fatalf("%v", err)
+ }
+}
+
+func writeFile(name, data string) {
+ err := ioutil.WriteFile(name, []byte(data), 0666)
+ if err != nil {
+ fatalf("%v", err)
+ }
+}
+
+func cleanup() {
+ const debug = false
+ if debug {
+ println("TMPDIR:", tmpdir)
+ return
+ }
+ os.Chdir(pwd) // get out of tmpdir before removing it
+ os.RemoveAll(tmpdir)
+}
+
+func fatalf(format string, args ...interface{}) {
+ cleanup()
+ log.Fatalf(format, args...)
+}
diff --git a/test/linkx.go b/test/linkx.go
index ac20334..20b8c77 100644
--- a/test/linkx.go
+++ b/test/linkx.go
@@ -1,6 +1,6 @@
// skip
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/linkx_run.go b/test/linkx_run.go
index a6c7c67..cc249c9 100644
--- a/test/linkx_run.go
+++ b/test/linkx_run.go
@@ -18,7 +18,7 @@
)
func main() {
- test(" ") // old deprecated syntax
+ // test(" ") // old deprecated & removed syntax
test("=") // new syntax
}
@@ -60,11 +60,11 @@
}
outstr := string(outx)
if !strings.Contains(outstr, "main.b") {
- fmt.Printf("-X linker flag did not diagnose overwrite of main.b\n")
+ fmt.Printf("-X linker flag did not diagnose overwrite of main.b:\n%s\n", outstr)
os.Exit(1)
}
if !strings.Contains(outstr, "main.x") {
- fmt.Printf("-X linker flag did not diagnose overwrite of main.x\n")
+ fmt.Printf("-X linker flag did not diagnose overwrite of main.x:\n%s\n", outstr)
os.Exit(1)
}
}
diff --git a/test/live.go b/test/live.go
index ae982f4..da0606d 100644
--- a/test/live.go
+++ b/test/live.go
@@ -1,6 +1,7 @@
+// +build !amd64
// errorcheck -0 -l -live -wb=0
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/live1.go b/test/live1.go
index b05ec1f..87c8c97 100644
--- a/test/live1.go
+++ b/test/live1.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/live2.go b/test/live2.go
index 7474756..a5bbfa5 100644
--- a/test/live2.go
+++ b/test/live2.go
@@ -1,6 +1,7 @@
+// +build !amd64
// errorcheck -0 -live -wb=0
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/live_ssa.go b/test/live_ssa.go
new file mode 100644
index 0000000..bd70924
--- /dev/null
+++ b/test/live_ssa.go
@@ -0,0 +1,648 @@
+// +build amd64
+// errorcheck -0 -l -live -wb=0
+
+// 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.
+
+// liveness tests with inlining disabled.
+// see also live2.go.
+
+package main
+
+func printnl()
+
+//go:noescape
+func printpointer(**int)
+
+//go:noescape
+func printintpointer(*int)
+
+//go:noescape
+func printstringpointer(*string)
+
+//go:noescape
+func printstring(string)
+
+//go:noescape
+func printbytepointer(*byte)
+
+func printint(int)
+
+func f1() {
+ var x *int
+ printpointer(&x) // ERROR "live at call to printpointer: x$"
+ printpointer(&x) // ERROR "live at call to printpointer: x$"
+}
+
+func f2(b bool) {
+ if b {
+ printint(0) // nothing live here
+ return
+ }
+ var x *int
+ printpointer(&x) // ERROR "live at call to printpointer: x$"
+ printpointer(&x) // ERROR "live at call to printpointer: x$"
+}
+
+func f3(b1, b2 bool) {
+ // Because x and y are ambiguously live, they appear
+ // live throughout the function, to avoid being poisoned
+ // in GODEBUG=gcdead=1 mode.
+
+ printint(0) // ERROR "live at call to printint: x y$"
+ if b1 == false {
+ printint(0) // ERROR "live at call to printint: x y$"
+ return
+ }
+
+ if b2 {
+ var x *int
+ printpointer(&x) // ERROR "live at call to printpointer: x y$"
+ printpointer(&x) // ERROR "live at call to printpointer: x y$"
+ } else {
+ var y *int
+ printpointer(&y) // ERROR "live at call to printpointer: x y$"
+ printpointer(&y) // ERROR "live at call to printpointer: x y$"
+ }
+ printint(0) // ERROR "f3: x \(type \*int\) is ambiguously live$" "f3: y \(type \*int\) is ambiguously live$" "live at call to printint: x y$"
+}
+
+// The old algorithm treated x as live on all code that
+// could flow to a return statement, so it included the
+// function entry and code above the declaration of x
+// but would not include an indirect use of x in an infinite loop.
+// Check that these cases are handled correctly.
+
+func f4(b1, b2 bool) { // x not live here
+ if b2 {
+ printint(0) // x not live here
+ return
+ }
+ var z **int
+ x := new(int)
+ *x = 42
+ z = &x
+ printint(**z) // ERROR "live at call to printint: x$"
+ if b2 {
+ printint(1) // x not live here
+ return
+ }
+ for {
+ printint(**z) // ERROR "live at call to printint: x$"
+ }
+}
+
+func f5(b1 bool) {
+ var z **int
+ if b1 {
+ x := new(int)
+ *x = 42
+ z = &x
+ } else {
+ y := new(int)
+ *y = 54
+ z = &y
+ }
+ printint(**z) // ERROR "f5: x \(type \*int\) is ambiguously live$" "f5: y \(type \*int\) is ambiguously live$" "live at call to printint: x y$"
+}
+
+// confusion about the _ result used to cause spurious "live at entry to f6: _".
+
+func f6() (_, y string) {
+ y = "hello"
+ return
+}
+
+// confusion about addressed results used to cause "live at entry to f7: x".
+
+func f7() (x string) {
+ _ = &x
+ x = "hello"
+ return
+}
+
+// ignoring block returns used to cause "live at entry to f8: x, y".
+
+func f8() (x, y string) {
+ return g8()
+}
+
+func g8() (string, string)
+
+// ignoring block assignments used to cause "live at entry to f9: x"
+// issue 7205
+
+var i9 interface{}
+
+func f9() bool {
+ g8()
+ x := i9
+ return x != interface{}(99.0i) // ERROR "live at call to convT2E: x.data x.type$"
+}
+
+// liveness formerly confused by UNDEF followed by RET,
+// leading to "live at entry to f10: ~r1" (unnamed result).
+
+func f10() string {
+ panic(1)
+}
+
+// liveness formerly confused by select, thinking runtime.selectgo
+// can return to next instruction; it always jumps elsewhere.
+// note that you have to use at least two cases in the select
+// to get a true select; smaller selects compile to optimized helper functions.
+
+var c chan *int
+var b bool
+
+// this used to have a spurious "live at entry to f11a: ~r0"
+func f11a() *int {
+ select { // ERROR "live at call to newselect: autotmp_[0-9]+$" "live at call to selectgo: autotmp_[0-9]+$"
+ case <-c: // ERROR "live at call to selectrecv: autotmp_[0-9]+$"
+ return nil
+ case <-c: // ERROR "live at call to selectrecv: autotmp_[0-9]+$"
+ return nil
+ }
+}
+
+func f11b() *int {
+ p := new(int)
+ if b {
+ // At this point p is dead: the code here cannot
+ // get to the bottom of the function.
+ // This used to have a spurious "live at call to printint: p".
+ printint(1) // nothing live here!
+ select { // ERROR "live at call to newselect: autotmp_[0-9]+$" "live at call to selectgo: autotmp_[0-9]+$"
+ case <-c: // ERROR "live at call to selectrecv: autotmp_[0-9]+$"
+ return nil
+ case <-c: // ERROR "live at call to selectrecv: autotmp_[0-9]+$"
+ return nil
+ }
+ }
+ println(*p)
+ return nil
+}
+
+var sink *int
+
+func f11c() *int {
+ p := new(int)
+ sink = p // prevent stack allocation, otherwise p is rematerializeable
+ if b {
+ // Unlike previous, the cases in this select fall through,
+ // so we can get to the println, so p is not dead.
+ printint(1) // ERROR "live at call to printint: p$"
+ select { // ERROR "live at call to newselect: autotmp_[0-9]+ p$" "live at call to selectgo: autotmp_[0-9]+ p$"
+ case <-c: // ERROR "live at call to selectrecv: autotmp_[0-9]+ p$"
+ case <-c: // ERROR "live at call to selectrecv: autotmp_[0-9]+ p$"
+ }
+ }
+ println(*p)
+ return nil
+}
+
+// similarly, select{} does not fall through.
+// this used to have a spurious "live at entry to f12: ~r0".
+
+func f12() *int {
+ if b {
+ select {}
+ } else {
+ return nil
+ }
+}
+
+// incorrectly placed VARDEF annotations can cause missing liveness annotations.
+// this used to be missing the fact that s is live during the call to g13 (because it is
+// needed for the call to h13).
+
+func f13() {
+ s := g14()
+ s = h13(s, g13(s)) // ERROR "live at call to g13: s.ptr$"
+}
+
+func g13(string) string
+func h13(string, string) string
+
+// more incorrectly placed VARDEF.
+
+func f14() {
+ x := g14()
+ printstringpointer(&x) // ERROR "live at call to printstringpointer: x$"
+}
+
+func g14() string
+
+func f15() {
+ var x string
+ _ = &x
+ x = g15() // ERROR "live at call to g15: x$"
+ printstring(x) // ERROR "live at call to printstring: x$"
+}
+
+func g15() string
+
+// Checking that various temporaries do not persist or cause
+// ambiguously live values that must be zeroed.
+// The exact temporary names are inconsequential but we are
+// trying to check that there is only one at any given site,
+// and also that none show up in "ambiguously live" messages.
+
+var m map[string]int
+
+func f16() {
+ if b {
+ delete(m, "hi") // ERROR "live at call to mapdelete: autotmp_[0-9]+$"
+ }
+ delete(m, "hi") // ERROR "live at call to mapdelete: autotmp_[0-9]+$"
+ delete(m, "hi") // ERROR "live at call to mapdelete: autotmp_[0-9]+$"
+}
+
+var m2s map[string]*byte
+var m2 map[[2]string]*byte
+var x2 [2]string
+var bp *byte
+
+func f17a() {
+ // value temporary only
+ if b {
+ m2[x2] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+$"
+ }
+ m2[x2] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+$"
+ m2[x2] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+$"
+}
+
+func f17b() {
+ // key temporary only
+ if b {
+ m2s["x"] = bp // ERROR "live at call to mapassign1: autotmp_[0-9]+$"
+ }
+ m2s["x"] = bp // ERROR "live at call to mapassign1: autotmp_[0-9]+$"
+ m2s["x"] = bp // ERROR "live at call to mapassign1: autotmp_[0-9]+$"
+}
+
+func f17c() {
+ // key and value temporaries
+ if b {
+ m2s["x"] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+ autotmp_[0-9]+$"
+ }
+ m2s["x"] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+ autotmp_[0-9]+$"
+ m2s["x"] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+ autotmp_[0-9]+$"
+}
+
+func g18() [2]string
+
+func f18() {
+ // key temporary for mapaccess.
+ // temporary introduced by orderexpr.
+ var z *byte
+ if b {
+ z = m2[g18()] // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ }
+ z = m2[g18()] // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ z = m2[g18()] // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printbytepointer(z)
+}
+
+var ch chan *byte
+
+func f19() {
+ // dest temporary for channel receive.
+ var z *byte
+
+ if b {
+ z = <-ch // ERROR "live at call to chanrecv1: autotmp_[0-9]+$"
+ }
+ z = <-ch // ERROR "live at call to chanrecv1: autotmp_[0-9]+$"
+ z = <-ch // ERROR "live at call to chanrecv1: autotmp_[0-9]+$"
+ printbytepointer(z)
+}
+
+func f20() {
+ // src temporary for channel send
+ if b {
+ ch <- nil // ERROR "live at call to chansend1: autotmp_[0-9]+$"
+ }
+ ch <- nil // ERROR "live at call to chansend1: autotmp_[0-9]+$"
+ ch <- nil // ERROR "live at call to chansend1: autotmp_[0-9]+$"
+}
+
+func f21() {
+ // key temporary for mapaccess using array literal key.
+ var z *byte
+ if b {
+ z = m2[[2]string{"x", "y"}] // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ }
+ z = m2[[2]string{"x", "y"}] // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ z = m2[[2]string{"x", "y"}] // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printbytepointer(z)
+}
+
+func f23() {
+ // key temporary for two-result map access using array literal key.
+ var z *byte
+ var ok bool
+ if b {
+ z, ok = m2[[2]string{"x", "y"}] // ERROR "live at call to mapaccess2: autotmp_[0-9]+$"
+ }
+ z, ok = m2[[2]string{"x", "y"}] // ERROR "live at call to mapaccess2: autotmp_[0-9]+$"
+ z, ok = m2[[2]string{"x", "y"}] // ERROR "live at call to mapaccess2: autotmp_[0-9]+$"
+ printbytepointer(z)
+ print(ok)
+}
+
+func f24() {
+ // key temporary for map access using array literal key.
+ // value temporary too.
+ if b {
+ m2[[2]string{"x", "y"}] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+ autotmp_[0-9]+$"
+ }
+ m2[[2]string{"x", "y"}] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+ autotmp_[0-9]+$"
+ m2[[2]string{"x", "y"}] = nil // ERROR "live at call to mapassign1: autotmp_[0-9]+ autotmp_[0-9]+$"
+}
+
+// defer should not cause spurious ambiguously live variables
+
+func f25(b bool) {
+ defer g25()
+ if b {
+ return
+ }
+ var x string
+ _ = &x
+ x = g15() // ERROR "live at call to g15: x$"
+ printstring(x) // ERROR "live at call to printstring: x$"
+} // ERROR "live at call to deferreturn: x$"
+
+func g25()
+
+// non-escaping ... slices passed to function call should die on return,
+// so that the temporaries do not stack and do not cause ambiguously
+// live variables.
+
+func f26(b bool) {
+ if b {
+ print26((*int)(nil), (*int)(nil), (*int)(nil)) // ERROR "live at call to print26: autotmp_[0-9]+$"
+ }
+ print26((*int)(nil), (*int)(nil), (*int)(nil)) // ERROR "live at call to print26: autotmp_[0-9]+$"
+ print26((*int)(nil), (*int)(nil), (*int)(nil)) // ERROR "live at call to print26: autotmp_[0-9]+$"
+ printnl()
+}
+
+//go:noescape
+func print26(...interface{})
+
+// non-escaping closures passed to function call should die on return
+
+func f27(b bool) {
+ x := 0
+ if b {
+ call27(func() { x++ }) // ERROR "live at call to call27: autotmp_[0-9]+$"
+ }
+ call27(func() { x++ }) // ERROR "live at call to call27: autotmp_[0-9]+$"
+ call27(func() { x++ }) // ERROR "live at call to call27: autotmp_[0-9]+$"
+ printnl()
+}
+
+// but defer does escape to later execution in the function
+
+func f27defer(b bool) {
+ x := 0
+ if b {
+ defer call27(func() { x++ }) // ERROR "live at call to deferproc: autotmp_[0-9]+$" "live at call to deferreturn: autotmp_[0-9]+$"
+ }
+ defer call27(func() { x++ }) // ERROR "f27defer: autotmp_[0-9]+ \(type struct { F uintptr; x \*int }\) is ambiguously live$" "live at call to deferproc: autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to deferreturn: autotmp_[0-9]+ autotmp_[0-9]+$"
+ printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ autotmp_[0-9]+$"
+} // ERROR "live at call to deferreturn: autotmp_[0-9]+ autotmp_[0-9]+$"
+
+// and newproc (go) escapes to the heap
+
+func f27go(b bool) {
+ x := 0
+ if b {
+ go call27(func() { x++ }) // ERROR "live at call to newobject: &x$" "live at call to newproc: &x$"
+ }
+ go call27(func() { x++ }) // ERROR "live at call to newobject: &x$"
+ printnl()
+}
+
+//go:noescape
+func call27(func())
+
+// concatstring slice should die on return
+
+var s1, s2, s3, s4, s5, s6, s7, s8, s9, s10 string
+
+func f28(b bool) {
+ if b {
+ printstring(s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10) // ERROR "live at call to concatstrings: autotmp_[0-9]+$" "live at call to printstring: autotmp_[0-9]+$"
+ }
+ printstring(s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10) // ERROR "live at call to concatstrings: autotmp_[0-9]+$" "live at call to printstring: autotmp_[0-9]+$"
+ printstring(s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8 + s9 + s10) // ERROR "live at call to concatstrings: autotmp_[0-9]+$" "live at call to printstring: autotmp_[0-9]+$"
+}
+
+// map iterator should die on end of range loop
+
+func f29(b bool) {
+ if b {
+ for k := range m { // ERROR "live at call to mapiterinit: autotmp_[0-9]+$" "live at call to mapiternext: autotmp_[0-9]+$"
+ printstring(k) // ERROR "live at call to printstring: autotmp_[0-9]+$"
+ }
+ }
+ for k := range m { // ERROR "live at call to mapiterinit: autotmp_[0-9]+$" "live at call to mapiternext: autotmp_[0-9]+$"
+ printstring(k) // ERROR "live at call to printstring: autotmp_[0-9]+$"
+ }
+ for k := range m { // ERROR "live at call to mapiterinit: autotmp_[0-9]+$" "live at call to mapiternext: autotmp_[0-9]+$"
+ printstring(k) // ERROR "live at call to printstring: autotmp_[0-9]+$"
+ }
+}
+
+// copy of array of pointers should die at end of range loop
+
+var ptrarr [10]*int
+
+func f30(b bool) {
+ // two live temps during print(p):
+ // the copy of ptrarr and the internal iterator pointer.
+ if b {
+ for _, p := range ptrarr {
+ printintpointer(p) // ERROR "live at call to printintpointer: autotmp_[0-9]+ autotmp_[0-9]+$"
+ }
+ }
+ for _, p := range ptrarr {
+ printintpointer(p) // ERROR "live at call to printintpointer: autotmp_[0-9]+ autotmp_[0-9]+$"
+ }
+ for _, p := range ptrarr {
+ printintpointer(p) // ERROR "live at call to printintpointer: autotmp_[0-9]+ autotmp_[0-9]+$"
+ }
+}
+
+// conversion to interface should not leave temporary behind
+
+func f31(b1, b2, b3 bool) {
+ if b1 {
+ g31("a") // ERROR "live at call to convT2E: autotmp_[0-9]+$" "live at call to g31: autotmp_[0-9]+$"
+ }
+ if b2 {
+ h31("b") // ERROR "live at call to convT2E: autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to h31: autotmp_[0-9]+$" "live at call to newobject: autotmp_[0-9]+$"
+ }
+ if b3 {
+ panic("asdf") // ERROR "live at call to convT2E: autotmp_[0-9]+$" "live at call to gopanic: autotmp_[0-9]+$"
+ }
+ print(b3)
+}
+
+func g31(interface{})
+func h31(...interface{})
+
+// non-escaping partial functions passed to function call should die on return
+
+type T32 int
+
+func (t *T32) Inc() { // ERROR "live at entry to \(\*T32\).Inc: t$"
+ *t++
+}
+
+var t32 T32
+
+func f32(b bool) {
+ if b {
+ call32(t32.Inc) // ERROR "live at call to call32: autotmp_[0-9]+$"
+ }
+ call32(t32.Inc) // ERROR "live at call to call32: autotmp_[0-9]+$"
+ call32(t32.Inc) // ERROR "live at call to call32: autotmp_[0-9]+$"
+}
+
+//go:noescape
+func call32(func())
+
+// temporaries introduced during if conditions and && || expressions
+// should die once the condition has been acted upon.
+
+var m33 map[interface{}]int
+
+func f33() {
+ if m33[nil] == 0 { // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printnl()
+ return
+ } else {
+ printnl()
+ }
+ printnl()
+}
+
+func f34() {
+ if m33[nil] == 0 { // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printnl()
+ return
+ }
+ printnl()
+}
+
+func f35() {
+ if m33[nil] == 0 && m33[nil] == 0 { // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printnl()
+ return
+ }
+ printnl()
+}
+
+func f36() {
+ if m33[nil] == 0 || m33[nil] == 0 { // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printnl()
+ return
+ }
+ printnl()
+}
+
+func f37() {
+ if (m33[nil] == 0 || m33[nil] == 0) && m33[nil] == 0 { // ERROR "live at call to mapaccess1: autotmp_[0-9]+$"
+ printnl()
+ return
+ }
+ printnl()
+}
+
+// select temps should disappear in the case bodies
+
+var c38 chan string
+
+func fc38() chan string
+func fi38(int) *string
+func fb38() *bool
+
+func f38(b bool) {
+ // we don't care what temps are printed on the lines with output.
+ // we care that the println lines have no live variables
+ // and therefore no output.
+ if b {
+ select { // ERROR "live at call to newselect: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to selectgo: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$"
+ case <-fc38(): // ERROR "live at call to selectrecv: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$"
+ printnl()
+ case fc38() <- *fi38(1): // ERROR "live at call to fc38: autotmp_[0-9]+$" "live at call to fi38: autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to selectsend: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$"
+ printnl()
+ case *fi38(2) = <-fc38(): // ERROR "live at call to fc38: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to fi38: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to selectrecv: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$"
+ printnl()
+ case *fi38(3), *fb38() = <-fc38(): // ERROR "live at call to fb38: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to fc38: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to fi38: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$" "live at call to selectrecv2: autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+ autotmp_[0-9]+$"
+ printnl()
+ }
+ printnl()
+ }
+ printnl()
+}
+
+// issue 8097: mishandling of x = x during return.
+
+func f39() (x []int) {
+ x = []int{1}
+ printnl() // ERROR "live at call to printnl: autotmp_[0-9]+$"
+ return x
+}
+
+func f39a() (x []int) {
+ x = []int{1}
+ printnl() // ERROR "live at call to printnl: autotmp_[0-9]+$"
+ return
+}
+
+func f39b() (x [10]*int) {
+ x = [10]*int{}
+ x[0] = new(int) // ERROR "live at call to newobject: x$"
+ printnl() // ERROR "live at call to printnl: x$"
+ return x
+}
+
+func f39c() (x [10]*int) {
+ x = [10]*int{}
+ x[0] = new(int) // ERROR "live at call to newobject: x$"
+ printnl() // ERROR "live at call to printnl: x$"
+ return
+}
+
+// issue 8142: lost 'addrtaken' bit on inlined variables.
+// no inlining in this test, so just checking that non-inlined works.
+
+type T40 struct {
+ m map[int]int
+}
+
+func newT40() *T40 {
+ ret := T40{}
+ ret.m = make(map[int]int) // ERROR "live at call to makemap: &ret$"
+ return &ret
+}
+
+func bad40() {
+ t := newT40()
+ _ = t
+ printnl()
+}
+
+func good40() {
+ ret := T40{}
+ ret.m = make(map[int]int) // ERROR "live at call to makemap: autotmp_[0-9]+ ret$"
+ t := &ret
+ printnl() // ERROR "live at call to printnl: autotmp_[0-9]+ ret$"
+ _ = t
+}
diff --git a/test/live_syscall.go b/test/live_syscall.go
new file mode 100644
index 0000000..8aaa691
--- /dev/null
+++ b/test/live_syscall.go
@@ -0,0 +1,28 @@
+// errorcheck -0 -m -live
+
+// +build !windows
+
+// Copyright 2015 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.
+
+// Test escape analysis and liveness inferred for syscall.Syscall-like functions.
+
+package p
+
+import (
+ "syscall"
+ "unsafe"
+)
+
+func f(uintptr) // ERROR "f assuming arg#1 is unsafe uintptr"
+
+func g() {
+ var t int
+ f(uintptr(unsafe.Pointer(&t))) // ERROR "live at call to f: autotmp" "g &t does not escape"
+}
+
+func h() {
+ var v int
+ syscall.Syscall(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to Syscall: autotmp" "h &v does not escape"
+}
diff --git a/test/loopbce.go b/test/loopbce.go
new file mode 100644
index 0000000..ea19521
--- /dev/null
+++ b/test/loopbce.go
@@ -0,0 +1,253 @@
+// +build amd64
+// errorcheck -0 -d=ssa/loopbce/debug=3
+
+package main
+
+func f0a(a []int) int {
+ x := 0
+ for i := range a { // ERROR "Induction variable with minimum 0 and increment 1$"
+ x += a[i] // ERROR "Found redundant IsInBounds$"
+ }
+ return x
+}
+
+func f0b(a []int) int {
+ x := 0
+ for i := range a { // ERROR "Induction variable with minimum 0 and increment 1$"
+ b := a[i:] // ERROR "Found redundant IsSliceInBounds$"
+ x += b[0]
+ }
+ return x
+}
+
+func f0c(a []int) int {
+ x := 0
+ for i := range a { // ERROR "Induction variable with minimum 0 and increment 1$"
+ b := a[:i+1] // ERROR "Found redundant IsSliceInBounds \(len promoted to cap\)$"
+ x += b[0]
+ }
+ return x
+}
+
+func f1(a []int) int {
+ x := 0
+ for _, i := range a { // ERROR "Induction variable with minimum 0 and increment 1$"
+ x += i
+ }
+ return x
+}
+
+func f2(a []int) int {
+ x := 0
+ for i := 1; i < len(a); i++ { // ERROR "Induction variable with minimum 1 and increment 1$"
+ x += a[i] // ERROR "Found redundant IsInBounds$"
+ }
+ return x
+}
+
+func f4(a [10]int) int {
+ x := 0
+ for i := 0; i < len(a); i += 2 { // ERROR "Induction variable with minimum 0 and increment 2$"
+ x += a[i] // ERROR "Found redundant IsInBounds$"
+ }
+ return x
+}
+
+func f5(a [10]int) int {
+ x := 0
+ for i := -10; i < len(a); i += 2 { // ERROR "Induction variable with minimum -10 and increment 2$"
+ x += a[i]
+ }
+ return x
+}
+
+func f6(a []int) {
+ for i := range a { // ERROR "Induction variable with minimum 0 and increment 1$"
+ b := a[0:i] // ERROR "Found redundant IsSliceInBounds \(len promoted to cap\)$"
+ f6(b)
+ }
+}
+
+func g0a(a string) int {
+ x := 0
+ for i := 0; i < len(a); i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ x += int(a[i]) // ERROR "Found redundant IsInBounds$"
+ }
+ return x
+}
+
+func g0b(a string) int {
+ x := 0
+ for i := 0; len(a) > i; i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ x += int(a[i]) // ERROR "Found redundant IsInBounds$"
+ }
+ return x
+}
+
+func g1() int {
+ a := "evenlength"
+ x := 0
+ for i := 0; i < len(a); i += 2 { // ERROR "Induction variable with minimum 0 and increment 2$"
+ x += int(a[i]) // ERROR "Found redundant IsInBounds$"
+ }
+ return x
+}
+
+func g2() int {
+ a := "evenlength"
+ x := 0
+ for i := 0; i < len(a); i += 2 { // ERROR "Induction variable with minimum 0 and increment 2$"
+ j := i
+ if a[i] == 'e' { // ERROR "Found redundant IsInBounds$"
+ j = j + 1
+ }
+ x += int(a[j])
+ }
+ return x
+}
+
+func g3a() {
+ a := "this string has length 25"
+ for i := 0; i < len(a); i += 5 { // ERROR "Induction variable with minimum 0 and increment 5$"
+ useString(a[i:]) // ERROR "Found redundant IsSliceInBounds$"
+ useString(a[:i+3])
+ }
+}
+
+func g3b(a string) {
+ for i := 0; i < len(a); i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ useString(a[i+1:]) // ERROR "Found redundant IsSliceInBounds$"
+ }
+}
+
+func g3c(a string) {
+ for i := 0; i < len(a); i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ useString(a[:i+1]) // ERROR "Found redundant IsSliceInBounds$"
+ }
+}
+
+func h1(a []byte) {
+ c := a[:128]
+ for i := range c { // ERROR "Induction variable with minimum 0 and increment 1$"
+ c[i] = byte(i) // ERROR "Found redundant IsInBounds$"
+ }
+}
+
+func h2(a []byte) {
+ for i := range a[:128] { // ERROR "Induction variable with minimum 0 and increment 1$"
+ a[i] = byte(i)
+ }
+}
+
+func k0(a [100]int) [100]int {
+ for i := 10; i < 90; i++ { // ERROR "Induction variable with minimum 10 and increment 1$"
+ a[i-11] = i
+ a[i-10] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 80$"
+ a[i-5] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 85$"
+ a[i] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 90$"
+ a[i+5] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 95$"
+ a[i+10] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 100$"
+ a[i+11] = i
+ }
+ return a
+}
+
+func k1(a [100]int) [100]int {
+ for i := 10; i < 90; i++ { // ERROR "Induction variable with minimum 10 and increment 1$"
+ useSlice(a[:i-11])
+ useSlice(a[:i-10]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 80$"
+ useSlice(a[:i-5]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 85$"
+ useSlice(a[:i]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 90$"
+ useSlice(a[:i+5]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 95$"
+ useSlice(a[:i+10]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 100$"
+ useSlice(a[:i+11]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 101$"
+
+ }
+ return a
+}
+
+func k2(a [100]int) [100]int {
+ for i := 10; i < 90; i++ { // ERROR "Induction variable with minimum 10 and increment 1$"
+ useSlice(a[i-11:])
+ useSlice(a[i-10:]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 80$"
+ useSlice(a[i-5:]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 85$"
+ useSlice(a[i:]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 90$"
+ useSlice(a[i+5:]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 95$"
+ useSlice(a[i+10:]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 100$"
+ useSlice(a[i+11:]) // ERROR "Found redundant \(IsSliceInBounds ind 100\), ind < 101$"
+ }
+ return a
+}
+
+func k3(a [100]int) [100]int {
+ for i := -10; i < 90; i++ { // ERROR "Induction variable with minimum -10 and increment 1$"
+ a[i+10] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 100$"
+ }
+ return a
+}
+
+func k4(a [100]int) [100]int {
+ min := (-1) << 63
+ for i := min; i < min+50; i++ { // ERROR "Induction variable with minimum -9223372036854775808 and increment 1$"
+ a[i-min] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 50$"
+ }
+ return a
+}
+
+func k5(a [100]int) [100]int {
+ max := (1 << 63) - 1
+ for i := max - 50; i < max; i++ { // ERROR "Induction variable with minimum 9223372036854775757 and increment 1$"
+ a[i-max+50] = i
+ a[i-(max-70)] = i // ERROR "Found redundant \(IsInBounds ind 100\), ind < 70$"
+ }
+ return a
+}
+
+func nobce1() {
+ // tests overflow of max-min
+ a := int64(9223372036854774057)
+ b := int64(-1547)
+ z := int64(1337)
+
+ if a%z == b%z {
+ panic("invalid test: modulos should differ")
+ }
+
+ for i := b; i < a; i += z {
+ // No induction variable is possible because i will overflow a first iteration.
+ useString("foobar")
+ }
+}
+
+func nobce2(a string) {
+ for i := int64(0); i < int64(len(a)); i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ useString(a[i:]) // ERROR "Found redundant IsSliceInBounds$"
+ }
+ for i := int64(0); i < int64(len(a))-31337; i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ useString(a[i:]) // ERROR "Found redundant IsSliceInBounds$"
+ }
+ for i := int64(0); i < int64(len(a))+int64(-1<<63); i++ { // ERROR "Induction variable with minimum 0 and increment 1$"
+ // tests an overflow of StringLen-MinInt64
+ useString(a[i:])
+ }
+}
+
+func nobce3(a [100]int64) [100]int64 {
+ min := int64((-1) << 63)
+ max := int64((1 << 63) - 1)
+ for i := min; i < max; i++ { // ERROR "Induction variable with minimum -9223372036854775808 and increment 1$"
+ a[i] = i
+ }
+ return a
+}
+
+//go:noinline
+func useString(a string) {
+}
+
+//go:noinline
+func useSlice(a []int) {
+}
+
+func main() {
+}
diff --git a/test/map1.go b/test/map1.go
index 6f1a1c8..d3c0a90 100644
--- a/test/map1.go
+++ b/test/map1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/method1.go b/test/method1.go
index 365b8ca..bb8c81d 100644
--- a/test/method1.go
+++ b/test/method1.go
@@ -9,12 +9,16 @@
package main
-type T struct { }
-func (t *T) M(int, string) // GCCGO_ERROR "previous"
-func (t *T) M(int, float64) { } // ERROR "redeclared|redefinition"
+type T struct{}
-func f(int, string) // GCCGO_ERROR "previous"
-func f(int, float64) { } // ERROR "redeclared|redefinition"
+func (t *T) M(int, string) // GCCGO_ERROR "previous"
+func (t *T) M(int, float64) {} // ERROR "redeclared|redefinition"
-func g(a int, b string) // GCCGO_ERROR "previous"
-func g(a int, c string) // ERROR "redeclared|redefinition"
+func (t T) H() // GCCGO_ERROR "previous"
+func (t *T) H() {} // ERROR "redeclared|redefinition"
+
+func f(int, string) // GCCGO_ERROR "previous"
+func f(int, float64) {} // ERROR "redeclared|redefinition"
+
+func g(a int, b string) // GCCGO_ERROR "previous"
+func g(a int, c string) // ERROR "redeclared|redefinition"
diff --git a/test/method5.go b/test/method5.go
index 36508f2..d87bb6f 100644
--- a/test/method5.go
+++ b/test/method5.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/named.go b/test/named.go
index d0330ab..9763c76 100644
--- a/test/named.go
+++ b/test/named.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/named1.go b/test/named1.go
index febad64..7feae13 100644
--- a/test/named1.go
+++ b/test/named1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/nilcheck.go b/test/nilcheck.go
index 99c3c5f..6879438 100644
--- a/test/nilcheck.go
+++ b/test/nilcheck.go
@@ -1,6 +1,6 @@
// errorcheck -0 -N -d=nil
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
@@ -17,7 +17,7 @@
type BigStruct struct {
X int
Y float64
- A [1<<20]int
+ A [1 << 20]int
Z string
}
@@ -29,86 +29,86 @@
}
var (
- intp *int
- arrayp *[10]int
- array0p *[0]int
- bigarrayp *[1<<26]int
- structp *Struct
+ intp *int
+ arrayp *[10]int
+ array0p *[0]int
+ bigarrayp *[1 << 26]int
+ structp *Struct
bigstructp *BigStruct
- emptyp *Empty
- empty1p *Empty1
+ emptyp *Empty
+ empty1p *Empty1
)
func f1() {
- _ = *intp // ERROR "nil check"
- _ = *arrayp // ERROR "nil check"
+ _ = *intp // ERROR "nil check"
+ _ = *arrayp // ERROR "nil check"
_ = *array0p // ERROR "nil check"
_ = *array0p // ERROR "nil check"
- _ = *intp // ERROR "nil check"
- _ = *arrayp // ERROR "nil check"
+ _ = *intp // ERROR "nil check"
+ _ = *arrayp // ERROR "nil check"
_ = *structp // ERROR "nil check"
- _ = *emptyp // ERROR "nil check"
- _ = *arrayp // ERROR "nil check"
+ _ = *emptyp // ERROR "nil check"
+ _ = *arrayp // ERROR "nil check"
}
func f2() {
var (
- intp *int
- arrayp *[10]int
- array0p *[0]int
- bigarrayp *[1<<20]int
- structp *Struct
+ intp *int
+ arrayp *[10]int
+ array0p *[0]int
+ bigarrayp *[1 << 20]int
+ structp *Struct
bigstructp *BigStruct
- emptyp *Empty
- empty1p *Empty1
+ emptyp *Empty
+ empty1p *Empty1
)
- _ = *intp // ERROR "nil check"
- _ = *arrayp // ERROR "nil check"
- _ = *array0p // ERROR "nil check"
- _ = *array0p // ERROR "nil check"
- _ = *intp // ERROR "nil check"
- _ = *arrayp // ERROR "nil check"
- _ = *structp // ERROR "nil check"
- _ = *emptyp // ERROR "nil check"
- _ = *arrayp // ERROR "nil check"
- _ = *bigarrayp // ERROR "nil check"
+ _ = *intp // ERROR "nil check"
+ _ = *arrayp // ERROR "nil check"
+ _ = *array0p // ERROR "nil check"
+ _ = *array0p // ERROR "nil check"
+ _ = *intp // ERROR "nil check"
+ _ = *arrayp // ERROR "nil check"
+ _ = *structp // ERROR "nil check"
+ _ = *emptyp // ERROR "nil check"
+ _ = *arrayp // ERROR "nil check"
+ _ = *bigarrayp // ERROR "nil check"
_ = *bigstructp // ERROR "nil check"
- _ = *empty1p // ERROR "nil check"
+ _ = *empty1p // ERROR "nil check"
}
func fx10k() *[10000]int
-var b bool
+var b bool
func f3(x *[10000]int) {
// Using a huge type and huge offsets so the compiler
// does not expect the memory hardware to fault.
_ = x[9999] // ERROR "nil check"
-
+
for {
if x[9999] != 0 { // ERROR "nil check"
break
}
}
-
- x = fx10k()
+
+ x = fx10k()
_ = x[9999] // ERROR "nil check"
if b {
_ = x[9999] // ERROR "nil check"
} else {
_ = x[9999] // ERROR "nil check"
- }
+ }
_ = x[9999] // ERROR "nil check"
- x = fx10k()
+ x = fx10k()
if b {
_ = x[9999] // ERROR "nil check"
} else {
_ = x[9999] // ERROR "nil check"
- }
+ }
_ = x[9999] // ERROR "nil check"
-
+
fx10k()
// This one is a bit redundant, if we figured out that
// x wasn't going to change across the function call.
@@ -138,7 +138,7 @@
_ = &x[9] // ERROR "nil check"
}
-func fx10() *[10]int
+func fx10() *[10]int
func f4(x *[10]int) {
// Most of these have no checks because a real memory reference follows,
@@ -146,33 +146,33 @@
// in the first unmapped page of memory.
_ = x[9] // ERROR "nil check"
-
+
for {
if x[9] != 0 { // ERROR "nil check"
break
}
}
-
- x = fx10()
+
+ x = fx10()
_ = x[9] // ERROR "nil check"
if b {
_ = x[9] // ERROR "nil check"
} else {
_ = x[9] // ERROR "nil check"
- }
+ }
_ = x[9] // ERROR "nil check"
- x = fx10()
+ x = fx10()
if b {
_ = x[9] // ERROR "nil check"
} else {
_ = &x[9] // ERROR "nil check"
- }
+ }
_ = x[9] // ERROR "nil check"
-
+
fx10()
_ = x[9] // ERROR "nil check"
-
+
x = fx10()
y := fx10()
_ = &x[9] // ERROR "nil check"
diff --git a/test/nilptr.go b/test/nilptr.go
index 9631d16..8d674a7 100644
--- a/test/nilptr.go
+++ b/test/nilptr.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/nilptr2.go b/test/nilptr2.go
index 57a5f80..a5c0369 100644
--- a/test/nilptr2.go
+++ b/test/nilptr2.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/nilptr3.go b/test/nilptr3.go
index 607c6fb..8922729 100644
--- a/test/nilptr3.go
+++ b/test/nilptr3.go
@@ -1,9 +1,10 @@
// errorcheck -0 -d=nil
// Fails on ppc64x because of incomplete optimization.
// See issues 9058.
-// +build !ppc64,!ppc64le
+// Same reason for mips64x and s390x.
+// +build !ppc64,!ppc64le,!mips64,!mips64le,!amd64,!s390x
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
@@ -192,3 +193,24 @@
x = y
_ = &x[9] // ERROR "removed repeated nil check"
}
+
+func m1(m map[int][80]byte) byte {
+ v := m[3] // ERROR "removed nil check"
+ return v[5]
+}
+func m2(m map[int][800]byte) byte {
+ v := m[3] // ERROR "removed nil check"
+ return v[5]
+}
+func m3(m map[int][80]byte) (byte, bool) {
+ v, ok := m[3] // ERROR "removed nil check"
+ return v[5], ok
+}
+func m4(m map[int][800]byte) (byte, bool) {
+ v, ok := m[3] // ERROR "removed nil check"
+ return v[5], ok
+}
+func p1() byte {
+ p := new([100]byte)
+ return p[5] // ERROR "removed nil check"
+}
diff --git a/test/nilptr3_ssa.go b/test/nilptr3_ssa.go
new file mode 100644
index 0000000..0d690eb
--- /dev/null
+++ b/test/nilptr3_ssa.go
@@ -0,0 +1,230 @@
+// errorcheck -0 -d=nil
+// Fails on ppc64x because of incomplete optimization.
+// See issues 9058.
+// +build !ppc64,!ppc64le,amd64
+
+// Copyright 2013 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.
+
+// Test that nil checks are removed.
+// Optimization is enabled.
+
+package p
+
+type Struct struct {
+ X int
+ Y float64
+}
+
+type BigStruct struct {
+ X int
+ Y float64
+ A [1 << 20]int
+ Z string
+}
+
+type Empty struct {
+}
+
+type Empty1 struct {
+ Empty
+}
+
+var (
+ intp *int
+ arrayp *[10]int
+ array0p *[0]int
+ bigarrayp *[1 << 26]int
+ structp *Struct
+ bigstructp *BigStruct
+ emptyp *Empty
+ empty1p *Empty1
+)
+
+func f1() {
+ _ = *intp // ERROR "generated nil check"
+
+ // This one should be removed but the block copy needs
+ // to be turned into its own pseudo-op in order to see
+ // the indirect.
+ _ = *arrayp // ERROR "generated nil check"
+
+ // 0-byte indirect doesn't suffice.
+ // we don't registerize globals, so there are no removed.* nil checks.
+ _ = *array0p // ERROR "generated nil check"
+ _ = *array0p // ERROR "removed nil check"
+
+ _ = *intp // ERROR "removed nil check"
+ _ = *arrayp // ERROR "removed nil check"
+ _ = *structp // ERROR "generated nil check"
+ _ = *emptyp // ERROR "generated nil check"
+ _ = *arrayp // ERROR "removed nil check"
+}
+
+func f2() {
+ var (
+ intp *int
+ arrayp *[10]int
+ array0p *[0]int
+ bigarrayp *[1 << 20]int
+ structp *Struct
+ bigstructp *BigStruct
+ emptyp *Empty
+ empty1p *Empty1
+ )
+
+ _ = *intp // ERROR "generated nil check"
+ _ = *arrayp // ERROR "generated nil check"
+ _ = *array0p // ERROR "generated nil check"
+ _ = *array0p // ERROR "removed.* nil check"
+ _ = *intp // ERROR "removed.* nil check"
+ _ = *arrayp // ERROR "removed.* nil check"
+ _ = *structp // ERROR "generated nil check"
+ _ = *emptyp // ERROR "generated nil check"
+ _ = *arrayp // ERROR "removed.* nil check"
+ _ = *bigarrayp // ERROR "generated nil check" ARM removed nil check before indirect!!
+ _ = *bigstructp // ERROR "generated nil check"
+ _ = *empty1p // ERROR "generated nil check"
+}
+
+func fx10k() *[10000]int
+
+var b bool
+
+func f3(x *[10000]int) {
+ // Using a huge type and huge offsets so the compiler
+ // does not expect the memory hardware to fault.
+ _ = x[9999] // ERROR "generated nil check"
+
+ for {
+ if x[9999] != 0 { // ERROR "removed nil check"
+ break
+ }
+ }
+
+ x = fx10k()
+ _ = x[9999] // ERROR "generated nil check"
+ if b {
+ _ = x[9999] // ERROR "removed.* nil check"
+ } else {
+ _ = x[9999] // ERROR "removed.* nil check"
+ }
+ _ = x[9999] // ERROR "removed nil check"
+
+ x = fx10k()
+ if b {
+ _ = x[9999] // ERROR "generated nil check"
+ } else {
+ _ = x[9999] // ERROR "generated nil check"
+ }
+ _ = x[9999] // ERROR "generated nil check"
+
+ fx10k()
+ // This one is a bit redundant, if we figured out that
+ // x wasn't going to change across the function call.
+ // But it's a little complex to do and in practice doesn't
+ // matter enough.
+ _ = x[9999] // ERROR "removed nil check"
+}
+
+func f3a() {
+ x := fx10k()
+ y := fx10k()
+ z := fx10k()
+ _ = &x[9] // ERROR "generated nil check"
+ y = z
+ _ = &x[9] // ERROR "removed.* nil check"
+ x = y
+ _ = &x[9] // ERROR "generated nil check"
+}
+
+func f3b() {
+ x := fx10k()
+ y := fx10k()
+ _ = &x[9] // ERROR "generated nil check"
+ y = x
+ _ = &x[9] // ERROR "removed.* nil check"
+ x = y
+ _ = &x[9] // ERROR "removed.* nil check"
+}
+
+func fx10() *[10]int
+
+func f4(x *[10]int) {
+ // Most of these have no checks because a real memory reference follows,
+ // and the offset is small enough that if x is nil, the address will still be
+ // in the first unmapped page of memory.
+
+ _ = x[9] // ERROR "removed nil check"
+
+ for {
+ if x[9] != 0 { // ERROR "removed nil check"
+ break
+ }
+ }
+
+ x = fx10()
+ _ = x[9] // ERROR "generated nil check" // bug would like to remove before indirect
+ if b {
+ _ = x[9] // ERROR "removed nil check"
+ } else {
+ _ = x[9] // ERROR "removed nil check"
+ }
+ _ = x[9] // ERROR "removed nil check"
+
+ x = fx10()
+ if b {
+ _ = x[9] // ERROR "generated nil check" // bug would like to remove before indirect
+ } else {
+ _ = &x[9] // ERROR "generated nil check"
+ }
+ _ = x[9] // ERROR "generated nil check" // bug would like to remove before indirect
+
+ fx10()
+ _ = x[9] // ERROR "removed nil check"
+
+ x = fx10()
+ y := fx10()
+ _ = &x[9] // ERROR "generated nil check"
+ y = x
+ _ = &x[9] // ERROR "removed[a-z ]* nil check"
+ x = y
+ _ = &x[9] // ERROR "removed[a-z ]* nil check"
+}
+
+func f5(p *float32, q *float64, r *float32, s *float64) float64 {
+ x := float64(*p) // ERROR "removed nil check"
+ y := *q // ERROR "removed nil check"
+ *r = 7 // ERROR "removed nil check"
+ *s = 9 // ERROR "removed nil check"
+ return x + y
+}
+
+type T [29]byte
+
+func f6(p, q *T) {
+ x := *p // ERROR "removed nil check"
+ *q = x // ERROR "removed nil check"
+}
+
+func m1(m map[int][80]byte) byte {
+ v := m[3] // ERROR "removed nil check"
+ return v[5]
+}
+func m2(m map[int][800]byte) byte {
+ v := m[3] // ERROR "removed nil check"
+ return v[5]
+}
+func m3(m map[int][80]byte) (byte, bool) {
+ v, ok := m[3] // ERROR "removed nil check"
+ return v[5], ok
+}
+func m4(m map[int][800]byte) (byte, bool) {
+ v, ok := m[3] // ERROR "removed nil check"
+ return v[5], ok
+}
+func p1() byte {
+ p := new([100]byte)
+ return p[5] // ERROR "removed nil check"
+}
diff --git a/test/nilptr4.go b/test/nilptr4.go
index 3dd7d4e..c75ce10 100644
--- a/test/nilptr4.go
+++ b/test/nilptr4.go
@@ -1,6 +1,6 @@
// build
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/nosplit.go b/test/nosplit.go
index e5c2a9f..a58a645 100644
--- a/test/nosplit.go
+++ b/test/nosplit.go
@@ -1,7 +1,7 @@
// +build !nacl
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
@@ -115,10 +115,15 @@
main 136
# A nosplit leaf can use the whole 128-CallSize bytes available on entry.
-main 112 nosplit
-main 116 nosplit
-main 120 nosplit
-main 124 nosplit
+# (CallSize is 32 on ppc64)
+main 96 nosplit
+main 100 nosplit; REJECT ppc64 ppc64le
+main 104 nosplit; REJECT ppc64 ppc64le
+main 108 nosplit; REJECT ppc64 ppc64le
+main 112 nosplit; REJECT ppc64 ppc64le
+main 116 nosplit; REJECT ppc64 ppc64le
+main 120 nosplit; REJECT ppc64 ppc64le
+main 124 nosplit; REJECT ppc64 ppc64le
main 128 nosplit; REJECT
main 132 nosplit; REJECT
main 136 nosplit; REJECT
@@ -126,11 +131,16 @@
# Calling a nosplit function from a nosplit function requires
# having room for the saved caller PC and the called frame.
# Because ARM doesn't save LR in the leaf, it gets an extra 4 bytes.
-# Because ppc64 doesn't save LR in the leaf, it gets an extra 8 bytes.
-main 112 nosplit call f; f 0 nosplit
-main 116 nosplit call f; f 0 nosplit
-main 120 nosplit call f; f 0 nosplit; REJECT amd64
-main 124 nosplit call f; f 0 nosplit; REJECT amd64 386
+# Because arm64 doesn't save LR in the leaf, it gets an extra 8 bytes.
+# ppc64 doesn't save LR in the leaf, but CallSize is 32, so it gets 24 fewer bytes than amd64.
+main 96 nosplit call f; f 0 nosplit
+main 100 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
+main 104 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
+main 108 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
+main 112 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
+main 116 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le
+main 120 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le amd64
+main 124 nosplit call f; f 0 nosplit; REJECT ppc64 ppc64le amd64 386
main 128 nosplit call f; f 0 nosplit; REJECT
main 132 nosplit call f; f 0 nosplit; REJECT
main 136 nosplit call f; f 0 nosplit; REJECT
@@ -138,24 +148,28 @@
# Calling a splitting function from a nosplit function requires
# having room for the saved caller PC of the call but also the
# saved caller PC for the call to morestack.
-# Again the ARM and ppc64 work in less space.
-main 104 nosplit call f; f 0 call f
-main 108 nosplit call f; f 0 call f
-main 112 nosplit call f; f 0 call f; REJECT amd64
-main 116 nosplit call f; f 0 call f; REJECT amd64
-main 120 nosplit call f; f 0 call f; REJECT amd64 386
-main 124 nosplit call f; f 0 call f; REJECT amd64 386
+# RISC architectures differ in the same way as before.
+main 96 nosplit call f; f 0 call f
+main 100 nosplit call f; f 0 call f; REJECT ppc64 ppc64le
+main 104 nosplit call f; f 0 call f; REJECT ppc64 ppc64le
+main 108 nosplit call f; f 0 call f; REJECT ppc64 ppc64le
+main 112 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64
+main 116 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64
+main 120 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64 386
+main 124 nosplit call f; f 0 call f; REJECT ppc64 ppc64le amd64 386
main 128 nosplit call f; f 0 call f; REJECT
main 132 nosplit call f; f 0 call f; REJECT
main 136 nosplit call f; f 0 call f; REJECT
# Indirect calls are assumed to be splitting functions.
-main 104 nosplit callind
-main 108 nosplit callind
-main 112 nosplit callind; REJECT amd64
-main 116 nosplit callind; REJECT amd64
-main 120 nosplit callind; REJECT amd64 386
-main 124 nosplit callind; REJECT amd64 386
+main 96 nosplit callind
+main 100 nosplit callind; REJECT ppc64 ppc64le
+main 104 nosplit callind; REJECT ppc64 ppc64le
+main 108 nosplit callind; REJECT ppc64 ppc64le
+main 112 nosplit callind; REJECT ppc64 ppc64le amd64
+main 116 nosplit callind; REJECT ppc64 ppc64le amd64
+main 120 nosplit callind; REJECT ppc64 ppc64le amd64 386
+main 124 nosplit callind; REJECT ppc64 ppc64le amd64 386
main 128 nosplit callind; REJECT
main 132 nosplit callind; REJECT
main 136 nosplit callind; REJECT
@@ -247,6 +261,9 @@
var buf bytes.Buffer
ptrSize := 4
switch goarch {
+ case "mips64", "mips64le":
+ ptrSize = 8
+ fmt.Fprintf(&buf, "#define CALL JAL\n#define REGISTER (R0)\n")
case "ppc64", "ppc64le":
ptrSize = 8
fmt.Fprintf(&buf, "#define CALL BL\n#define REGISTER (CTR)\n")
@@ -258,6 +275,9 @@
case "amd64":
ptrSize = 8
fmt.Fprintf(&buf, "#define REGISTER AX\n")
+ case "s390x":
+ ptrSize = 8
+ fmt.Fprintf(&buf, "#define REGISTER R10\n")
default:
fmt.Fprintf(&buf, "#define REGISTER AX\n")
}
@@ -281,16 +301,17 @@
name := m[1]
size, _ := strconv.Atoi(m[2])
- // The limit was originally 128 but is now 512.
+ // The limit was originally 128 but is now 592.
// Instead of rewriting the test cases above, adjust
// the first stack frame to use up the extra bytes.
if i == 0 {
- size += 512 - 128
+ size += (720 - 128) - 128
// Noopt builds have a larger stackguard.
- // See ../cmd/dist/buildruntime.go:stackGuardMultiplier
+ // See ../src/cmd/dist/buildruntime.go:stackGuardMultiplier
+ // This increase is included in obj.StackGuard
for _, s := range strings.Split(os.Getenv("GO_GCFLAGS"), " ") {
if s == "-N" {
- size += 640
+ size += 720
}
}
}
diff --git a/test/opt_branchlikely.go b/test/opt_branchlikely.go
new file mode 100644
index 0000000..5781253
--- /dev/null
+++ b/test/opt_branchlikely.go
@@ -0,0 +1,85 @@
+// +build amd64
+// errorcheck -0 -d=ssa/likelyadjust/debug=1
+
+// Copyright 2016 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.
+
+// Test that branches have some prediction properties.
+package foo
+
+func f(x, y, z int) int {
+ a := 0
+ for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
+ for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
+ a += j
+ }
+ for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
+ a -= x + y + z
+ }
+ }
+ return a
+}
+
+func g(x, y, z int) int {
+ a := 0
+ if y == 0 { // ERROR "Branch prediction rule default < call"
+ y = g(y, z, x)
+ } else {
+ y++
+ }
+ if y == x { // ERROR "Branch prediction rule default < call"
+ y = g(y, z, x)
+ } else {
+ }
+ if y == 2 { // ERROR "Branch prediction rule default < call"
+ z++
+ } else {
+ y = g(z, x, y)
+ }
+ if y+z == 3 { // ERROR "Branch prediction rule call < exit"
+ println("ha ha")
+ } else {
+ panic("help help help")
+ }
+ if x != 0 { // ERROR "Branch prediction rule default < ret"
+ for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
+ if x == 4 { // ERROR "Branch prediction rule stay in loop"
+ return a
+ }
+ for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
+ for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
+ a -= j * i
+ }
+ a += j
+ }
+ }
+ }
+ return a
+}
+
+func h(x, y, z int) int {
+ a := 0
+ for i := 0; i < x; i++ { // ERROR "Branch prediction rule stay in loop"
+ for j := 0; j < y; j++ { // ERROR "Branch prediction rule stay in loop"
+ a += j
+ if i == j { // ERROR "Branch prediction rule stay in loop"
+ break
+ }
+ a *= j
+ }
+ for k := 0; k < z; k++ { // ERROR "Branch prediction rule stay in loop"
+ a -= k
+ if i == k {
+ continue
+ }
+ a *= k
+ }
+ }
+ if a > 0 { // ERROR "Branch prediction rule default < call"
+ a = g(x, y, z)
+ } else {
+ a = -a
+ }
+ return a
+}
diff --git a/test/phiopt.go b/test/phiopt.go
new file mode 100644
index 0000000..21dd131
--- /dev/null
+++ b/test/phiopt.go
@@ -0,0 +1,108 @@
+// +build amd64
+// errorcheck -0 -d=ssa/phiopt/debug=3
+
+// Copyright 2016 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 main
+
+//go:noinline
+func f0(a bool) bool {
+ x := false
+ if a {
+ x = true
+ } else {
+ x = false
+ }
+ return x // ERROR "converted OpPhi to Copy$"
+}
+
+//go:noinline
+func f1(a bool) bool {
+ x := false
+ if a {
+ x = false
+ } else {
+ x = true
+ }
+ return x // ERROR "converted OpPhi to Not$"
+}
+
+//go:noinline
+func f2(a, b int) bool {
+ x := true
+ if a == b {
+ x = false
+ }
+ return x // ERROR "converted OpPhi to Not$"
+}
+
+//go:noinline
+func f3(a, b int) bool {
+ x := false
+ if a == b {
+ x = true
+ }
+ return x // ERROR "converted OpPhi to Copy$"
+}
+
+//go:noinline
+func f4(a, b bool) bool {
+ return a || b // ERROR "converted OpPhi to OrB$"
+}
+
+//go:noinline
+func f5or(a int, b bool) bool {
+ var x bool
+ if a == 0 {
+ x = true
+ } else {
+ x = b
+ }
+ return x // ERROR "converted OpPhi to OrB$"
+}
+
+//go:noinline
+func f5and(a int, b bool) bool {
+ var x bool
+ if a == 0 {
+ x = b
+ } else {
+ x = false
+ }
+ return x // ERROR "converted OpPhi to AndB$"
+}
+
+//go:noinline
+func f6or(a int, b bool) bool {
+ x := b
+ if a == 0 {
+ // f6or has side effects so the OpPhi should not be converted.
+ x = f6or(a, b)
+ }
+ return x
+}
+
+//go:noinline
+func f6and(a int, b bool) bool {
+ x := b
+ if a == 0 {
+ // f6and has side effects so the OpPhi should not be converted.
+ x = f6and(a, b)
+ }
+ return x
+}
+
+//go:noinline
+func f7or(a bool, b bool) bool {
+ return a || b // ERROR "converted OpPhi to OrB$"
+}
+
+//go:noinline
+func f7and(a bool, b bool) bool {
+ return a && b // ERROR "converted OpPhi to AndB$"
+}
+
+func main() {
+}
diff --git a/test/prove.go b/test/prove.go
new file mode 100644
index 0000000..8bcc9ae
--- /dev/null
+++ b/test/prove.go
@@ -0,0 +1,450 @@
+// +build amd64
+// errorcheck -0 -d=ssa/prove/debug=3
+
+// Copyright 2016 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 main
+
+import "math"
+
+func f0(a []int) int {
+ a[0] = 1
+ a[0] = 1 // ERROR "Proved boolean IsInBounds$"
+ a[6] = 1
+ a[6] = 1 // ERROR "Proved boolean IsInBounds$"
+ a[5] = 1 // ERROR "Proved IsInBounds$"
+ a[5] = 1 // ERROR "Proved boolean IsInBounds$"
+ return 13
+}
+
+func f1(a []int) int {
+ if len(a) <= 5 {
+ return 18
+ }
+ a[0] = 1 // ERROR "Proved non-negative bounds IsInBounds$"
+ a[0] = 1 // ERROR "Proved boolean IsInBounds$"
+ a[6] = 1
+ a[6] = 1 // ERROR "Proved boolean IsInBounds$"
+ a[5] = 1 // ERROR "Proved IsInBounds$"
+ a[5] = 1 // ERROR "Proved boolean IsInBounds$"
+ return 26
+}
+
+func f1b(a []int, i int, j uint) int {
+ if i >= 0 && i < len(a) {
+ return a[i] // ERROR "Proved non-negative bounds IsInBounds$"
+ }
+ if i >= 10 && i < len(a) {
+ return a[i] // ERROR "Proved non-negative bounds IsInBounds$"
+ }
+ if i >= 10 && i < len(a) {
+ return a[i] // ERROR "Proved non-negative bounds IsInBounds$"
+ }
+ if i >= 10 && i < len(a) { // todo: handle this case
+ return a[i-10]
+ }
+ if j < uint(len(a)) {
+ return a[j] // ERROR "Proved IsInBounds$"
+ }
+ return 0
+}
+
+func f1c(a []int, i int64) int {
+ c := uint64(math.MaxInt64 + 10) // overflows int
+ d := int64(c)
+ if i >= d && i < int64(len(a)) {
+ // d overflows, should not be handled.
+ return a[i]
+ }
+ return 0
+}
+
+func f2(a []int) int {
+ for i := range a {
+ a[i+1] = i
+ a[i+1] = i // ERROR "Proved boolean IsInBounds$"
+ }
+ return 34
+}
+
+func f3(a []uint) int {
+ for i := uint(0); i < uint(len(a)); i++ {
+ a[i] = i // ERROR "Proved IsInBounds$"
+ }
+ return 41
+}
+
+func f4a(a, b, c int) int {
+ if a < b {
+ if a == b { // ERROR "Disproved Eq64$"
+ return 47
+ }
+ if a > b { // ERROR "Disproved Greater64$"
+ return 50
+ }
+ if a < b { // ERROR "Proved boolean Less64$"
+ return 53
+ }
+ if a == b { // ERROR "Disproved boolean Eq64$"
+ return 56
+ }
+ if a > b { // ERROR "Disproved boolean Greater64$"
+ return 59
+ }
+ return 61
+ }
+ return 63
+}
+
+func f4b(a, b, c int) int {
+ if a <= b {
+ if a >= b {
+ if a == b { // ERROR "Proved Eq64$"
+ return 70
+ }
+ return 75
+ }
+ return 77
+ }
+ return 79
+}
+
+func f4c(a, b, c int) int {
+ if a <= b {
+ if a >= b {
+ if a != b { // ERROR "Disproved Neq64$"
+ return 73
+ }
+ return 75
+ }
+ return 77
+ }
+ return 79
+}
+
+func f4d(a, b, c int) int {
+ if a < b {
+ if a < c {
+ if a < b { // ERROR "Proved boolean Less64$"
+ if a < c { // ERROR "Proved boolean Less64$"
+ return 87
+ }
+ return 89
+ }
+ return 91
+ }
+ return 93
+ }
+ return 95
+}
+
+func f4e(a, b, c int) int {
+ if a < b {
+ if b > a { // ERROR "Proved Greater64$"
+ return 101
+ }
+ return 103
+ }
+ return 105
+}
+
+func f4f(a, b, c int) int {
+ if a <= b {
+ if b > a {
+ if b == a { // ERROR "Disproved Eq64$"
+ return 112
+ }
+ return 114
+ }
+ if b >= a { // ERROR "Proved Geq64$"
+ if b == a { // ERROR "Proved Eq64$"
+ return 118
+ }
+ return 120
+ }
+ return 122
+ }
+ return 124
+}
+
+func f5(a, b uint) int {
+ if a == b {
+ if a <= b { // ERROR "Proved Leq64U$"
+ return 130
+ }
+ return 132
+ }
+ return 134
+}
+
+// These comparisons are compile time constants.
+func f6a(a uint8) int {
+ if a < a { // ERROR "Disproved Less8U$"
+ return 140
+ }
+ return 151
+}
+
+func f6b(a uint8) int {
+ if a < a { // ERROR "Disproved Less8U$"
+ return 140
+ }
+ return 151
+}
+
+func f6x(a uint8) int {
+ if a > a { // ERROR "Disproved Greater8U$"
+ return 143
+ }
+ return 151
+}
+
+func f6d(a uint8) int {
+ if a <= a { // ERROR "Proved Leq8U$"
+ return 146
+ }
+ return 151
+}
+
+func f6e(a uint8) int {
+ if a >= a { // ERROR "Proved Geq8U$"
+ return 149
+ }
+ return 151
+}
+
+func f7(a []int, b int) int {
+ if b < len(a) {
+ a[b] = 3
+ if b < len(a) { // ERROR "Proved boolean Less64$"
+ a[b] = 5 // ERROR "Proved boolean IsInBounds$"
+ }
+ }
+ return 161
+}
+
+func f8(a, b uint) int {
+ if a == b {
+ return 166
+ }
+ if a > b {
+ return 169
+ }
+ if a < b { // ERROR "Proved Less64U$"
+ return 172
+ }
+ return 174
+}
+
+func f9(a, b bool) int {
+ if a {
+ return 1
+ }
+ if a || b { // ERROR "Disproved boolean Arg$"
+ return 2
+ }
+ return 3
+}
+
+func f10(a string) int {
+ n := len(a)
+ if a[:n>>1] == "aaa" {
+ return 0
+ }
+ return 1
+}
+
+func f11a(a []int, i int) {
+ useInt(a[i])
+ useInt(a[i]) // ERROR "Proved boolean IsInBounds$"
+}
+
+func f11b(a []int, i int) {
+ useSlice(a[i:])
+ useSlice(a[i:]) // ERROR "Proved boolean IsSliceInBounds$"
+}
+
+func f11c(a []int, i int) {
+ useSlice(a[:i])
+ useSlice(a[:i]) // ERROR "Proved boolean IsSliceInBounds$"
+}
+
+func f11d(a []int, i int) {
+ useInt(a[2*i+7])
+ useInt(a[2*i+7])
+}
+
+func f12(a []int, b int) {
+ useSlice(a[:b])
+}
+
+func f13a(a, b, c int, x bool) int {
+ if a > 12 {
+ if x {
+ if a < 12 { // ERROR "Disproved Less64$"
+ return 1
+ }
+ }
+ if x {
+ if a <= 12 { // ERROR "Disproved Leq64$"
+ return 2
+ }
+ }
+ if x {
+ if a == 12 { // ERROR "Disproved Eq64$"
+ return 3
+ }
+ }
+ if x {
+ if a >= 12 { // ERROR "Proved Geq64$"
+ return 4
+ }
+ }
+ if x {
+ if a > 12 { // ERROR "Proved boolean Greater64$"
+ return 5
+ }
+ }
+ return 6
+ }
+ return 0
+}
+
+func f13b(a int, x bool) int {
+ if a == -9 {
+ if x {
+ if a < -9 { // ERROR "Disproved Less64$"
+ return 7
+ }
+ }
+ if x {
+ if a <= -9 { // ERROR "Proved Leq64$"
+ return 8
+ }
+ }
+ if x {
+ if a == -9 { // ERROR "Proved boolean Eq64$"
+ return 9
+ }
+ }
+ if x {
+ if a >= -9 { // ERROR "Proved Geq64$"
+ return 10
+ }
+ }
+ if x {
+ if a > -9 { // ERROR "Disproved Greater64$"
+ return 11
+ }
+ }
+ return 12
+ }
+ return 0
+}
+
+func f13c(a int, x bool) int {
+ if a < 90 {
+ if x {
+ if a < 90 { // ERROR "Proved boolean Less64$"
+ return 13
+ }
+ }
+ if x {
+ if a <= 90 { // ERROR "Proved Leq64$"
+ return 14
+ }
+ }
+ if x {
+ if a == 90 { // ERROR "Disproved Eq64$"
+ return 15
+ }
+ }
+ if x {
+ if a >= 90 { // ERROR "Disproved Geq64$"
+ return 16
+ }
+ }
+ if x {
+ if a > 90 { // ERROR "Disproved Greater64$"
+ return 17
+ }
+ }
+ return 18
+ }
+ return 0
+}
+
+func f13d(a int) int {
+ if a < 5 {
+ if a < 9 { // ERROR "Proved Less64$"
+ return 1
+ }
+ }
+ return 0
+}
+
+func f13e(a int) int {
+ if a > 9 {
+ if a > 5 { // ERROR "Proved Greater64$"
+ return 1
+ }
+ }
+ return 0
+}
+
+func f13f(a int64) int64 {
+ if a > math.MaxInt64 {
+ // Unreachable, but prove doesn't know that.
+ if a == 0 {
+ return 1
+ }
+ }
+ return 0
+}
+
+func f13g(a int) int {
+ if a < 3 {
+ return 5
+ }
+ if a > 3 {
+ return 6
+ }
+ if a == 3 { // ERROR "Proved Eq64$"
+ return 7
+ }
+ return 8
+}
+
+func f13h(a int) int {
+ if a < 3 {
+ if a > 1 {
+ if a == 2 { // ERROR "Proved Eq64$"
+ return 5
+ }
+ }
+ }
+ return 0
+}
+
+func f13i(a uint) int {
+ if a == 0 {
+ return 1
+ }
+ if a > 0 { // ERROR "Proved Greater64U$"
+ return 2
+ }
+ return 3
+}
+
+//go:noinline
+func useInt(a int) {
+}
+
+//go:noinline
+func useSlice(a []int) {
+}
+
+func main() {
+}
diff --git a/test/recover.go b/test/recover.go
index f92c15c..e4187c0 100644
--- a/test/recover.go
+++ b/test/recover.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/recover1.go b/test/recover1.go
index b763a10..c14a607 100644
--- a/test/recover1.go
+++ b/test/recover1.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/recover2.go b/test/recover2.go
index 946d05a..cf4657a 100644
--- a/test/recover2.go
+++ b/test/recover2.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/recover3.go b/test/recover3.go
index e17bfb3..1b26cb3 100644
--- a/test/recover3.go
+++ b/test/recover3.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/recover4.go b/test/recover4.go
index cda0813..da5117c 100644
--- a/test/recover4.go
+++ b/test/recover4.go
@@ -1,7 +1,7 @@
// +build linux darwin
// run
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
@@ -52,6 +52,8 @@
log.Fatalf("mmap: %v", err)
}
+ other := make([]byte, 16*size)
+
// Note: Cannot call syscall.Munmap, because Munmap checks
// that you are unmapping a whole region returned by Mmap.
// We are trying to unmap just a hole in the middle.
@@ -59,8 +61,6 @@
log.Fatalf("munmap: %v", err)
}
- other := make([]byte, 16*size)
-
// Check that memcopy returns the actual amount copied
// before the fault (8*size - 5, the offset we skip in the argument).
n, err := memcopy(data[5:], other)
diff --git a/test/reflectmethod1.go b/test/reflectmethod1.go
new file mode 100644
index 0000000..973bf15
--- /dev/null
+++ b/test/reflectmethod1.go
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2016 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.
+
+// The linker can prune methods that are not directly called or
+// assigned to interfaces, but only if reflect.Type.Method is
+// never used. Test it here.
+
+package main
+
+import "reflect"
+
+var called = false
+
+type M int
+
+func (m M) UniqueMethodName() {
+ called = true
+}
+
+var v M
+
+func main() {
+ reflect.TypeOf(v).Method(0).Func.Interface().(func(M))(v)
+ if !called {
+ panic("UniqueMethodName not called")
+ }
+}
diff --git a/test/reflectmethod2.go b/test/reflectmethod2.go
new file mode 100644
index 0000000..9ee1c24
--- /dev/null
+++ b/test/reflectmethod2.go
@@ -0,0 +1,36 @@
+// run
+
+// Copyright 2016 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.
+
+// The linker can prune methods that are not directly called or
+// assigned to interfaces, but only if reflect.Type.MethodByName is
+// never used. Test it here.
+
+package main
+
+import reflect1 "reflect"
+
+var called = false
+
+type M int
+
+func (m M) UniqueMethodName() {
+ called = true
+}
+
+var v M
+
+type MyType interface {
+ MethodByName(string) (reflect1.Method, bool)
+}
+
+func main() {
+ var t MyType = reflect1.TypeOf(v)
+ m, _ := t.MethodByName("UniqueMethodName")
+ m.Func.Interface().(func(M))(v)
+ if !called {
+ panic("UniqueMethodName not called")
+ }
+}
diff --git a/test/reflectmethod3.go b/test/reflectmethod3.go
new file mode 100644
index 0000000..b423a59
--- /dev/null
+++ b/test/reflectmethod3.go
@@ -0,0 +1,35 @@
+// run
+
+// Copyright 2016 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.
+
+// The linker can prune methods that are not directly called or
+// assigned to interfaces, but only if reflect.Type.Method is
+// never used. Test it here.
+
+package main
+
+import "reflect"
+
+var called = false
+
+type M int
+
+func (m M) UniqueMethodName() {
+ called = true
+}
+
+var v M
+
+type MyType interface {
+ Method(int) reflect.Method
+}
+
+func main() {
+ var t MyType = reflect.TypeOf(v)
+ t.Method(0).Func.Interface().(func(M))(v)
+ if !called {
+ panic("UniqueMethodName not called")
+ }
+}
diff --git a/test/reflectmethod4.go b/test/reflectmethod4.go
new file mode 100644
index 0000000..037b3da
--- /dev/null
+++ b/test/reflectmethod4.go
@@ -0,0 +1,30 @@
+// run
+
+// Copyright 2016 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.
+
+// The linker can prune methods that are not directly called or
+// assigned to interfaces, but only if reflect.Value.Method is
+// never used. Test it here.
+
+package main
+
+import "reflect"
+
+var called = false
+
+type M int
+
+func (m M) UniqueMethodName() {
+ called = true
+}
+
+var v M
+
+func main() {
+ reflect.ValueOf(v).Method(0).Interface().(func())()
+ if !called {
+ panic("UniqueMethodName not called")
+ }
+}
diff --git a/test/rename.go b/test/rename.go
index dc43417..83f184b 100644
--- a/test/rename.go
+++ b/test/rename.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/rename1.go b/test/rename1.go
index 53db68d..a71e5b2 100644
--- a/test/rename1.go
+++ b/test/rename1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/reorder.go b/test/reorder.go
index 8fd623c..fc44be9 100644
--- a/test/reorder.go
+++ b/test/reorder.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/reorder2.go b/test/reorder2.go
index e56be2b..07f1b15 100644
--- a/test/reorder2.go
+++ b/test/reorder2.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
@@ -58,9 +58,8 @@
log += "f(" + x + ", " + y + ")"
}
+//go:noinline
func ff(x, y string) {
- for false {
- } // prevent inl
log += "ff(" + x + ", " + y + ")"
}
@@ -69,9 +68,8 @@
return x
}
+//go:noinline
func g(x string) string {
- for false {
- } // prevent inl
log += "g(" + x + ")"
return x
}
@@ -167,7 +165,7 @@
err++
}
log = ""
-
+
x := 0
switch x {
case 0:
@@ -176,7 +174,7 @@
err++
}
log = ""
-
+
if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
println("in switch, expecting a(1)b(2)a(2), got ", log)
err++
@@ -194,7 +192,7 @@
}
log = ""
}
-
+
c := make(chan int, 1)
c <- 1
select {
@@ -206,7 +204,7 @@
err++
}
log = ""
-
+
if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
println("in select1, expecting a(1)b(2)a(2), got ", log)
err++
@@ -233,7 +231,7 @@
err++
}
log = ""
-
+
if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
println("in select2, expecting a(1)b(2)a(2), got ", log)
err++
@@ -255,14 +253,14 @@
c <- 1
select {
default:
- case c<-1:
+ case c <- 1:
case <-c:
if a("1")("2")("3"); log != "a(1)a(2)a(3)" {
println("in select3, expecting a(1)a(2)a(3) , got ", log)
err++
}
log = ""
-
+
if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
println("in select3, expecting a(1)b(2)a(2), got ", log)
err++
@@ -290,7 +288,7 @@
err++
}
log = ""
-
+
if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
println("in select4, expecting a(1)b(2)a(2), got ", log)
err++
@@ -318,7 +316,7 @@
err++
}
log = ""
-
+
if t.a("1").a(t.b("2")); log != "a(1)b(2)a(2)" {
println("in select5, expecting a(1)b(2)a(2), got ", log)
err++
diff --git a/test/return.go b/test/return.go
index 482f22b..95f94b9 100644
--- a/test/return.go
+++ b/test/return.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/rotate.go b/test/rotate.go
index 1d71497..9dc4b1e 100644
--- a/test/rotate.go
+++ b/test/rotate.go
@@ -2,7 +2,7 @@
// NOTE: the actual tests to run are rotate[0123].go
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
diff --git a/test/rotate0.go b/test/rotate0.go
index 400b225..09dd900 100644
--- a/test/rotate0.go
+++ b/test/rotate0.go
@@ -1,6 +1,6 @@
// runoutput ./rotate.go
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/rotate1.go b/test/rotate1.go
index 98b0b1c..19757ec 100644
--- a/test/rotate1.go
+++ b/test/rotate1.go
@@ -1,6 +1,6 @@
// runoutput ./rotate.go
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/rotate2.go b/test/rotate2.go
index c50f8ce..a55305a 100644
--- a/test/rotate2.go
+++ b/test/rotate2.go
@@ -1,6 +1,6 @@
// runoutput ./rotate.go
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/rotate3.go b/test/rotate3.go
index 73d47d8..edd5d3a 100644
--- a/test/rotate3.go
+++ b/test/rotate3.go
@@ -1,6 +1,6 @@
// runoutput ./rotate.go
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/run.go b/test/run.go
index 6e1cde9..a1ab9d5 100644
--- a/test/run.go
+++ b/test/run.go
@@ -1,6 +1,6 @@
// skip
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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.
@@ -34,9 +34,12 @@
var (
verbose = flag.Bool("v", false, "verbose. if set, parallelism is set to 1.")
+ keep = flag.Bool("k", false, "keep. keep temporary directory.")
numParallel = flag.Int("n", runtime.NumCPU(), "number of parallel tests to run")
summary = flag.Bool("summary", false, "show summary of results")
showSkips = flag.Bool("show_skips", false, "show skipped tests")
+ runSkips = flag.Bool("run_skips", false, "run skipped tests (ignore skip and build tags)")
+ linkshared = flag.Bool("linkshared", false, "")
updateErrors = flag.Bool("update_errors", false, "update error messages in test file based on compiler output")
runoutputLimit = flag.Int("l", defaultRunOutputLimit(), "number of parallel runoutput tests to run")
@@ -119,9 +122,9 @@
<-test.donec
status := "ok "
errStr := ""
- if _, isSkip := test.err.(skipError); isSkip {
+ if e, isSkip := test.err.(skipError); isSkip {
test.err = nil
- errStr = "unexpected skip for " + path.Join(test.dir, test.gofile) + ": " + errStr
+ errStr = "unexpected skip for " + path.Join(test.dir, test.gofile) + ": " + string(e)
status = "FAIL"
}
if test.err != nil {
@@ -132,9 +135,6 @@
failed = true
}
resCount[status]++
- if status == "skip" && !*verbose && !*showSkips {
- continue
- }
dt := fmt.Sprintf("%.3fs", test.dt.Seconds())
if status == "FAIL" {
fmt.Printf("# go run run.go -- %s\n%s\nFAIL\t%s\t%s\n",
@@ -194,11 +194,20 @@
type runCmd func(...string) ([]byte, error)
func compileFile(runcmd runCmd, longname string) (out []byte, err error) {
- return runcmd("go", "tool", "compile", "-e", longname)
+ cmd := []string{"go", "tool", "compile", "-e"}
+ if *linkshared {
+ cmd = append(cmd, "-dynlink", "-installsuffix=dynlink")
+ }
+ cmd = append(cmd, longname)
+ return runcmd(cmd...)
}
-func compileInDir(runcmd runCmd, dir string, names ...string) (out []byte, err error) {
+func compileInDir(runcmd runCmd, dir string, flags []string, names ...string) (out []byte, err error) {
cmd := []string{"go", "tool", "compile", "-e", "-D", ".", "-I", "."}
+ cmd = append(cmd, flags...)
+ if *linkshared {
+ cmd = append(cmd, "-dynlink", "-installsuffix=dynlink")
+ }
for _, name := range names {
cmd = append(cmd, filepath.Join(dir, name))
}
@@ -207,7 +216,12 @@
func linkFile(runcmd runCmd, goname string) (err error) {
pfile := strings.Replace(goname, ".go", ".o", -1)
- _, err = runcmd("go", "tool", "link", "-w", "-o", "a.exe", "-L", ".", pfile)
+ cmd := []string{"go", "tool", "link", "-w", "-o", "a.exe", "-L", "."}
+ if *linkshared {
+ cmd = append(cmd, "-linkshared", "-installsuffix=dynlink")
+ }
+ cmd = append(cmd, pfile)
+ _, err = runcmd(cmd...)
return
}
@@ -292,7 +306,9 @@
var packageRE = regexp.MustCompile(`(?m)^package (\w+)`)
-func goDirPackages(longdir string) ([][]string, error) {
+// If singlefilepkgs is set, each file is considered a separate package
+// even if the package names are the same.
+func goDirPackages(longdir string, singlefilepkgs bool) ([][]string, error) {
files, err := goDirFiles(longdir)
if err != nil {
return nil, err
@@ -310,7 +326,7 @@
return nil, fmt.Errorf("cannot find package name in %s", name)
}
i, ok := m[pkgname[1]]
- if !ok {
+ if singlefilepkgs || !ok {
i = len(pkgs)
pkgs = append(pkgs, nil)
m[pkgname[1]] = i
@@ -328,6 +344,9 @@
// shouldTest looks for build tags in a source file and returns
// whether the file should be used according to the tags.
func shouldTest(src string, goos, goarch string) (ok bool, whyNot string) {
+ if *runSkips {
+ return true, ""
+ }
for _, line := range strings.Split(src, "\n") {
line = strings.TrimSpace(line)
if strings.HasPrefix(line, "//") {
@@ -389,6 +408,10 @@
return true
}
+ if name == "test_run" {
+ return true
+ }
+
return false
}
@@ -443,12 +466,14 @@
var args, flags []string
wantError := false
+ singlefilepkgs := false
f := strings.Fields(action)
if len(f) > 0 {
action = f[0]
args = f[1:]
}
+ // TODO: Clean up/simplify this switch statement.
switch action {
case "rundircmpout":
action = "rundir"
@@ -458,18 +483,16 @@
fallthrough
case "compile", "compiledir", "build", "run", "runoutput", "rundir":
t.action = action
+ case "errorcheckandrundir":
+ wantError = false // should be no error if also will run
+ fallthrough
case "errorcheck", "errorcheckdir", "errorcheckoutput":
t.action = action
wantError = true
- for len(args) > 0 && strings.HasPrefix(args[0], "-") {
- if args[0] == "-0" {
- wantError = false
- } else {
- flags = append(flags, args[0])
- }
- args = args[1:]
- }
case "skip":
+ if *runSkips {
+ break
+ }
t.action = "skip"
return
default:
@@ -478,8 +501,23 @@
return
}
+ // collect flags
+ for len(args) > 0 && strings.HasPrefix(args[0], "-") {
+ switch args[0] {
+ case "-0":
+ wantError = false
+ case "-s":
+ singlefilepkgs = true
+ default:
+ flags = append(flags, args[0])
+ }
+ args = args[1:]
+ }
+
t.makeTempDir()
- defer os.RemoveAll(t.tempDir)
+ if !*keep {
+ defer os.RemoveAll(t.tempDir)
+ }
err = ioutil.WriteFile(filepath.Join(t.tempDir, t.gofile), srcBytes, 0644)
check(err)
@@ -493,6 +531,7 @@
}
useTmp := true
+ ssaMain := false
runcmd := func(args ...string) ([]byte, error) {
cmd := exec.Command(args[0], args[1:]...)
var buf bytes.Buffer
@@ -501,6 +540,11 @@
if useTmp {
cmd.Dir = t.tempDir
cmd.Env = envForDir(cmd.Dir)
+ } else {
+ cmd.Env = os.Environ()
+ }
+ if ssaMain && os.Getenv("GOARCH") == "amd64" {
+ cmd.Env = append(cmd.Env, "GOSSAPKG=main")
}
err := cmd.Run()
if err != nil {
@@ -516,6 +560,7 @@
case "errorcheck":
cmdline := []string{"go", "tool", "compile", "-e", "-o", "a.o"}
+ // No need to add -dynlink even if linkshared if we're just checking for errors...
cmdline = append(cmdline, flags...)
cmdline = append(cmdline, long)
out, err := runcmd(cmdline...)
@@ -542,29 +587,29 @@
case "compiledir":
// Compile all files in the directory in lexicographic order.
longdir := filepath.Join(cwd, t.goDirName())
- pkgs, err := goDirPackages(longdir)
+ pkgs, err := goDirPackages(longdir, singlefilepkgs)
if err != nil {
t.err = err
return
}
for _, gofiles := range pkgs {
- _, t.err = compileInDir(runcmd, longdir, gofiles...)
+ _, t.err = compileInDir(runcmd, longdir, flags, gofiles...)
if t.err != nil {
return
}
}
- case "errorcheckdir":
+ case "errorcheckdir", "errorcheckandrundir":
// errorcheck all files in lexicographic order
// useful for finding importing errors
longdir := filepath.Join(cwd, t.goDirName())
- pkgs, err := goDirPackages(longdir)
+ pkgs, err := goDirPackages(longdir, singlefilepkgs)
if err != nil {
t.err = err
return
}
for i, gofiles := range pkgs {
- out, err := compileInDir(runcmd, longdir, gofiles...)
+ out, err := compileInDir(runcmd, longdir, flags, gofiles...)
if i == len(pkgs)-1 {
if wantError && err == nil {
t.err = fmt.Errorf("compilation succeeded unexpectedly\n%s", out)
@@ -586,18 +631,22 @@
break
}
}
+ if action == "errorcheckdir" {
+ return
+ }
+ fallthrough
case "rundir":
// Compile all files in the directory in lexicographic order.
// then link as if the last file is the main package and run it
longdir := filepath.Join(cwd, t.goDirName())
- pkgs, err := goDirPackages(longdir)
+ pkgs, err := goDirPackages(longdir, singlefilepkgs)
if err != nil {
t.err = err
return
}
for i, gofiles := range pkgs {
- _, err := compileInDir(runcmd, longdir, gofiles...)
+ _, err := compileInDir(runcmd, longdir, flags, gofiles...)
if err != nil {
t.err = err
return
@@ -631,7 +680,13 @@
case "run":
useTmp = false
- out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
+ ssaMain = true
+ cmd := []string{"go", "run"}
+ if *linkshared {
+ cmd = append(cmd, "-linkshared")
+ }
+ cmd = append(cmd, t.goFileName())
+ out, err := runcmd(append(cmd, args...)...)
if err != nil {
t.err = err
return
@@ -646,7 +701,12 @@
<-rungatec
}()
useTmp = false
- out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
+ cmd := []string{"go", "run"}
+ if *linkshared {
+ cmd = append(cmd, "-linkshared")
+ }
+ cmd = append(cmd, t.goFileName())
+ out, err := runcmd(append(cmd, args...)...)
if err != nil {
t.err = err
return
@@ -656,7 +716,13 @@
t.err = fmt.Errorf("write tempfile:%s", err)
return
}
- out, err = runcmd("go", "run", tfile)
+ ssaMain = true
+ cmd = []string{"go", "run"}
+ if *linkshared {
+ cmd = append(cmd, "-linkshared")
+ }
+ cmd = append(cmd, tfile)
+ out, err = runcmd(cmd...)
if err != nil {
t.err = err
return
@@ -667,7 +733,12 @@
case "errorcheckoutput":
useTmp = false
- out, err := runcmd(append([]string{"go", "run", t.goFileName()}, args...)...)
+ cmd := []string{"go", "run"}
+ if *linkshared {
+ cmd = append(cmd, "-linkshared")
+ }
+ cmd = append(cmd, t.goFileName())
+ out, err := runcmd(append(cmd, args...)...)
if err != nil {
t.err = err
return
@@ -723,6 +794,9 @@
var err error
t.tempDir, err = ioutil.TempDir("", "")
check(err)
+ if *keep {
+ log.Printf("Temporary directory is %s", t.tempDir)
+ }
}
func (t *test) expectedOutput() string {
@@ -744,7 +818,7 @@
}
if strings.HasPrefix(line, "\t") {
res[len(res)-1] += "\n" + line
- } else if strings.HasPrefix(line, "go tool") || strings.HasPrefix(line, "<autogenerated>") {
+ } else if strings.HasPrefix(line, "go tool") || strings.HasPrefix(line, "<autogenerated>") || strings.HasPrefix(line, "#") {
continue
} else if strings.TrimSpace(line) != "" {
res = append(res, line)
@@ -819,7 +893,8 @@
return errors.New(buf.String())
}
-func (t *test) updateErrors(out string, file string) {
+func (t *test) updateErrors(out, file string) {
+ base := path.Base(file)
// Read in source file.
src, err := ioutil.ReadFile(file)
if err != nil {
@@ -853,6 +928,8 @@
continue
}
msg := errStr[colon2+2:]
+ msg = strings.Replace(msg, file, base, -1) // normalize file mentions in error itself
+ msg = strings.TrimLeft(msg, " \t")
for _, r := range []string{`\`, `*`, `+`, `[`, `]`, `(`, `)`} {
msg = strings.Replace(msg, r, `\`+r, -1)
}
diff --git a/test/rune.go b/test/rune.go
index c013c47..73a5aa2 100644
--- a/test/rune.go
+++ b/test/rune.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/runtime.go b/test/runtime.go
index 89f59e3..bccc9b5 100644
--- a/test/runtime.go
+++ b/test/runtime.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2009 The Go Authors. All rights reserved.
+// Copyright 2009 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.
diff --git a/test/shift1.go b/test/shift1.go
index 04f5321..aeefbc4 100644
--- a/test/shift1.go
+++ b/test/shift1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/shift2.go b/test/shift2.go
index 80e6bbc..adbfb77 100644
--- a/test/shift2.go
+++ b/test/shift2.go
@@ -1,6 +1,6 @@
// compile
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/sinit.go b/test/sinit.go
index 188a530..c4d0edf 100644
--- a/test/sinit.go
+++ b/test/sinit.go
@@ -1,6 +1,6 @@
// skip
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/sizeof.go b/test/sizeof.go
index c3db1e5..3e2689f 100644
--- a/test/sizeof.go
+++ b/test/sizeof.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/slice3.go b/test/slice3.go
index 857eaf3..8a184d1 100644
--- a/test/slice3.go
+++ b/test/slice3.go
@@ -1,6 +1,6 @@
// runoutput
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/slice3err.go b/test/slice3err.go
index 83fb39b..1309fdd 100644
--- a/test/slice3err.go
+++ b/test/slice3err.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/slicecap.go b/test/slicecap.go
index dceb7e2..f71a3b0 100644
--- a/test/slicecap.go
+++ b/test/slicecap.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2014 The Go Authors. All rights reserved.
+// 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.
diff --git a/test/sliceopt.go b/test/sliceopt.go
index c9d089f..a830ab7 100644
--- a/test/sliceopt.go
+++ b/test/sliceopt.go
@@ -1,6 +1,7 @@
+// +build !amd64
// errorcheck -0 -d=append,slice
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
diff --git a/test/strength.go b/test/strength.go
new file mode 100644
index 0000000..94d589c
--- /dev/null
+++ b/test/strength.go
@@ -0,0 +1,45 @@
+// runoutput
+
+// Copyright 2016 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.
+
+// Generate test of strength reduction for multiplications
+// with contstants. Especially useful for amd64/386.
+
+package main
+
+import "fmt"
+
+func testMul(fact, bits int) string {
+ n := fmt.Sprintf("testMul_%d_%d", fact, bits)
+ fmt.Printf("func %s(s int%d) {\n", n, bits)
+
+ want := 0
+ for i := 0; i < 200; i++ {
+ fmt.Printf(` if want, got := int%d(%d), s*%d; want != got {
+ failed = true
+ fmt.Printf("got %d * %%d == %%d, wanted %d\n", s, got)
+ }
+`, bits, want, i, i, want)
+ want += fact
+ }
+
+ fmt.Printf("}\n")
+ return fmt.Sprintf("%s(%d)", n, fact)
+}
+
+func main() {
+ fmt.Printf("package main\n")
+ fmt.Printf("import \"fmt\"\n")
+ fmt.Printf("var failed = false\n")
+
+ f1 := testMul(17, 32)
+ f2 := testMul(131, 64)
+
+ fmt.Printf("func main() {\n")
+ fmt.Println(f1)
+ fmt.Println(f2)
+ fmt.Printf("if failed {\n panic(\"multiplication failed\")\n}\n")
+ fmt.Printf("}\n")
+}
diff --git a/test/stress/maps.go b/test/stress/maps.go
index fc5ab05..8ada23a 100644
--- a/test/stress/maps.go
+++ b/test/stress/maps.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/stress/parsego.go b/test/stress/parsego.go
index a5856dd..98c4d9a 100644
--- a/test/stress/parsego.go
+++ b/test/stress/parsego.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/stress/runstress.go b/test/stress/runstress.go
index 76ab2a8..3f16fc9 100644
--- a/test/stress/runstress.go
+++ b/test/stress/runstress.go
@@ -1,4 +1,4 @@
-// Copyright 2013 The Go Authors. All rights reserved.
+// Copyright 2013 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.
diff --git a/test/struct0.go b/test/struct0.go
index e29eb30..403e977 100644
--- a/test/struct0.go
+++ b/test/struct0.go
@@ -1,6 +1,6 @@
// run
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/switch2.go b/test/switch2.go
new file mode 100644
index 0000000..11ff5c5
--- /dev/null
+++ b/test/switch2.go
@@ -0,0 +1,39 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that erroneous switch statements are detected by the compiler.
+// Does not compile.
+
+package main
+
+func f() {
+ switch {
+ case 0; // ERROR "expecting := or = or : or comma"
+ }
+
+ switch {
+ case 0; // ERROR "expecting := or = or : or comma"
+ default:
+ }
+
+ switch {
+ case 0: case 0: default:
+ }
+
+ switch {
+ case 0: f(); case 0:
+ case 0: f() case 0: // ERROR "unexpected case at end of statement"
+ }
+
+ switch {
+ case 0: f(); default:
+ case 0: f() default: // ERROR "unexpected default at end of statement"
+ }
+
+ switch {
+ if x: // ERROR "expecting case or default or }"
+ }
+}
diff --git a/test/switch5.go b/test/switch5.go
new file mode 100644
index 0000000..7da2c66
--- /dev/null
+++ b/test/switch5.go
@@ -0,0 +1,81 @@
+// errorcheck
+
+// Copyright 2016 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.
+
+// Verify that switch statements with duplicate cases are detected by the compiler.
+// Does not compile.
+
+package main
+
+import "fmt"
+
+func f0(x int) {
+ switch x {
+ case 0:
+ case 0: // ERROR "duplicate case 0 in switch"
+ }
+
+ switch x {
+ case 0:
+ case int(0): // ERROR "duplicate case 0 in switch"
+ }
+}
+
+func f1(x float32) {
+ switch x {
+ case 5:
+ case 5: // ERROR "duplicate case 5 in switch"
+ case 5.0: // ERROR "duplicate case 5 in switch"
+ }
+}
+
+func f2(s string) {
+ switch s {
+ case "":
+ case "": // ERROR "duplicate case .. in switch"
+ case "abc":
+ case "abc": // ERROR "duplicate case .abc. in switch"
+ }
+}
+
+func f3(e interface{}) {
+ switch e {
+ case 0:
+ case 0: // ERROR "duplicate case 0 in switch"
+ case int64(0):
+ case float32(10):
+ case float32(10): // ERROR "duplicate case float32\(10\) in switch"
+ case float64(10):
+ case float64(10): // ERROR "duplicate case float64\(10\) in switch"
+ }
+}
+
+func f4(e interface{}) {
+ switch e.(type) {
+ case int:
+ case int: // ERROR "duplicate case int in type switch"
+ case int64:
+ case error: // ERROR "duplicate case error in type switch"
+ case error:
+ case fmt.Stringer:
+ case fmt.Stringer: // ERROR "duplicate case fmt.Stringer in type switch"
+ case struct {
+ i int "tag1"
+ }:
+ case struct {
+ i int "tag2"
+ }:
+ case struct {
+ i int "tag1"
+ }: // ERROR "duplicate case struct { i int .tag1. } in type switch"
+ }
+}
+
+func f5(a [1]int) {
+ switch a {
+ case [1]int{0}:
+ case [1]int{0}: // OK -- see issue 15896
+ }
+}
diff --git a/test/switch6.go b/test/switch6.go
new file mode 100644
index 0000000..bd62c62
--- /dev/null
+++ b/test/switch6.go
@@ -0,0 +1,32 @@
+// errorcheck
+
+// Copyright 2016 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.
+
+// Check the compiler's switch handling that happens
+// at typechecking time.
+// This must be separate from other checks,
+// because errors during typechecking
+// prevent other errors from being discovered.
+
+package main
+
+// Verify that type switch statements with impossible cases are detected by the compiler.
+func f0(e error) {
+ switch e.(type) {
+ case int: // ERROR "impossible type switch case: e \(type error\) cannot have dynamic type int \(missing Error method\)"
+ }
+}
+
+// Verify that the compiler rejects multiple default cases.
+func f1(e interface{}) {
+ switch e { // ERROR "multiple defaults in switch"
+ default:
+ default:
+ }
+ switch e.(type) { // ERROR "multiple defaults in switch"
+ default:
+ default:
+ }
+}
diff --git a/test/syntax/chan.go b/test/syntax/chan.go
index 3b68bda..6f9d77d 100644
--- a/test/syntax/chan.go
+++ b/test/syntax/chan.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
@@ -8,10 +8,10 @@
type xyz struct {
ch chan
-} // ERROR "unexpected .*}.* in channel type"
+} // ERROR "unexpected .*}.* in channel type|missing channel element type"
-func Foo(y chan) { // ERROR "unexpected .*\).* in channel type"
+func Foo(y chan) { // ERROR "unexpected .*\).* in channel type|missing channel element type"
}
-func Bar(x chan, y int) { // ERROR "unexpected comma in channel type"
+func Bar(x chan, y int) { // ERROR "unexpected comma in channel type|missing channel element type"
}
diff --git a/test/syntax/chan1.go b/test/syntax/chan1.go
index 4860422..2e9929b 100644
--- a/test/syntax/chan1.go
+++ b/test/syntax/chan1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/composite.go b/test/syntax/composite.go
index 6565334..f891931 100644
--- a/test/syntax/composite.go
+++ b/test/syntax/composite.go
@@ -1,11 +1,11 @@
// errorcheck
-// Copyright 2012 The Go Authors. All rights reserved.
+// Copyright 2012 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 main
var a = []int{
- 3 // ERROR "need trailing comma before newline in composite literal"
+ 3 // ERROR "need trailing comma before newline in composite literal|expecting comma or }"
}
diff --git a/test/syntax/ddd.go b/test/syntax/ddd.go
new file mode 100644
index 0000000..476ae22
--- /dev/null
+++ b/test/syntax/ddd.go
@@ -0,0 +1,11 @@
+// errorcheck
+
+// Copyright 2016 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 main
+
+func f() {
+ g(f..3) // ERROR "unexpected literal \.3, expecting name or \("
+}
diff --git a/test/syntax/else.go b/test/syntax/else.go
index e985a9c..9537329 100644
--- a/test/syntax/else.go
+++ b/test/syntax/else.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/syntax/forvar.go b/test/syntax/forvar.go
index dc592d2..3a70d9c 100644
--- a/test/syntax/forvar.go
+++ b/test/syntax/forvar.go
@@ -1,10 +1,11 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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 main
func main() {
+ var x int // avoid undefined: x error below with recursive-descent parser
for var x = 0; x < 10; x++ { // ERROR "var declaration not allowed in for initializer"
diff --git a/test/syntax/if.go b/test/syntax/if.go
index b2a65f9..c208a9f 100644
--- a/test/syntax/if.go
+++ b/test/syntax/if.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/syntax/import.go b/test/syntax/import.go
index f0a7921..8010bed 100644
--- a/test/syntax/import.go
+++ b/test/syntax/import.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/interface.go b/test/syntax/interface.go
index 0b76b54..010d3ce 100644
--- a/test/syntax/interface.go
+++ b/test/syntax/interface.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/semi1.go b/test/syntax/semi1.go
index 6e04281..c755445 100644
--- a/test/syntax/semi1.go
+++ b/test/syntax/semi1.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/semi2.go b/test/syntax/semi2.go
index 23d7bd0..9216789 100644
--- a/test/syntax/semi2.go
+++ b/test/syntax/semi2.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/semi3.go b/test/syntax/semi3.go
index ca070d8..d625d08 100644
--- a/test/syntax/semi3.go
+++ b/test/syntax/semi3.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/semi4.go b/test/syntax/semi4.go
index 99c2d22..6315f34 100644
--- a/test/syntax/semi4.go
+++ b/test/syntax/semi4.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
@@ -8,7 +8,7 @@
func main() {
for x // GCCGO_ERROR "undefined"
- { // ERROR "missing .*{.* after for clause"
+ { // ERROR "missing .*{.* after for clause|missing operand"
z // GCCGO_ERROR "undefined"
diff --git a/test/syntax/semi5.go b/test/syntax/semi5.go
index cf690f0..c54a994 100644
--- a/test/syntax/semi5.go
+++ b/test/syntax/semi5.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/semi6.go b/test/syntax/semi6.go
index c1e1cc3..325cc27 100644
--- a/test/syntax/semi6.go
+++ b/test/syntax/semi6.go
@@ -1,13 +1,11 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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 main
type T // ERROR "unexpected semicolon or newline in type declaration"
-{
-
-
-
+// line below uncommented to avoid follow-up error
+// {
\ No newline at end of file
diff --git a/test/syntax/semi7.go b/test/syntax/semi7.go
index 6c9ade8..a1948b0 100644
--- a/test/syntax/semi7.go
+++ b/test/syntax/semi7.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
@@ -8,7 +8,7 @@
func main() {
if x { } // GCCGO_ERROR "undefined"
- else { } // ERROR "unexpected semicolon or newline before .?else.?"
+ else { } // ERROR "unexpected semicolon or newline before .?else.?|unexpected else"
}
diff --git a/test/syntax/topexpr.go b/test/syntax/topexpr.go
index c5958f5..be080d2 100644
--- a/test/syntax/topexpr.go
+++ b/test/syntax/topexpr.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/typesw.go b/test/syntax/typesw.go
index cd8cf35..8d89860 100644
--- a/test/syntax/typesw.go
+++ b/test/syntax/typesw.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2011 The Go Authors. All rights reserved.
+// Copyright 2011 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.
diff --git a/test/syntax/vareq.go b/test/syntax/vareq.go
index f08955e..0d4bb78 100644
--- a/test/syntax/vareq.go
+++ b/test/syntax/vareq.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/syntax/vareq1.go b/test/syntax/vareq1.go
index e900eab..a2f9f34 100644
--- a/test/syntax/vareq1.go
+++ b/test/syntax/vareq1.go
@@ -1,10 +1,10 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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 main
-var x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|expected ';' or newline after top level declaration"
+var x map[string]string{"a":"b"} // ERROR "unexpected { at end of statement|unexpected { after top level declaration|expected ';' or newline after top level declaration"
diff --git a/test/tinyfin.go b/test/tinyfin.go
index 8fb109f..5171dfc 100644
--- a/test/tinyfin.go
+++ b/test/tinyfin.go
@@ -10,53 +10,55 @@
import (
"runtime"
- "sync/atomic"
"time"
)
func main() {
- // Does not work on 32-bits due to partially conservative GC.
+ // Does not work on gccgo due to partially conservative GC.
// Try to enable when we have fully precise GC.
- if runtime.GOARCH != "amd64" {
- return
- }
- // Likewise for gccgo.
if runtime.Compiler == "gccgo" {
return
}
- N := int32(100)
- count := N
- done := make([]bool, N)
- for i := int32(0); i < N; i++ {
- x := i // subject to tiny alloc
+ const N = 100
+ finalized := make(chan int32, N)
+ for i := 0; i < N; i++ {
+ x := new(int32) // subject to tiny alloc
+ *x = int32(i)
// the closure must be big enough to be combined
- runtime.SetFinalizer(&x, func(p *int32) {
+ runtime.SetFinalizer(x, func(p *int32) {
+ finalized <- *p
+ })
+ }
+ runtime.GC()
+ count := 0
+ done := make([]bool, N)
+ timeout := time.After(5*time.Second)
+ for {
+ select {
+ case <-timeout:
+ println("timeout,", count, "finalized so far")
+ panic("not all finalizers are called")
+ case x := <-finalized:
// Check that p points to the correct subobject of the tiny allocation.
// It's a bit tricky, because we can't capture another variable
// with the expected value (it would be combined as well).
- if *p < 0 || *p >= N {
- println("got", *p)
+ if x < 0 || x >= N {
+ println("got", x)
panic("corrupted")
}
- if done[*p] {
- println("got", *p)
+ if done[x] {
+ println("got", x)
panic("already finalized")
}
- done[*p] = true
- atomic.AddInt32(&count, -1)
- })
- }
- for i := 0; i < 4; i++ {
- runtime.GC()
- time.Sleep(10 * time.Millisecond)
- }
- // Some of the finalizers may not be executed,
- // if the outermost allocations are combined with something persistent.
- // Currently 4 int32's are combined into a 16-byte block,
- // ensure that most of them are finalized.
- if count >= N/4 {
- println(count, "out of", N, "finalizer are not called")
- panic("not all finalizers are called")
+ done[x] = true
+ count++
+ if count > N/10*9 {
+ // Some of the finalizers may not be executed,
+ // if the outermost allocations are combined with something persistent.
+ // Currently 4 int32's are combined into a 16-byte block,
+ // ensure that most of them are finalized.
+ return
+ }
+ }
}
}
-
diff --git a/test/typecheckloop.go b/test/typecheckloop.go
new file mode 100644
index 0000000..3b3e788
--- /dev/null
+++ b/test/typecheckloop.go
@@ -0,0 +1,14 @@
+// errorcheck
+
+// Copyright 2015 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.
+
+// Verify that constant definition loops are caught during
+// typechecking and that the errors print correctly.
+
+package main
+
+const A = 1 + B // ERROR "constant definition loop\n.*A uses B\n.*B uses C\n.*C uses A"
+const B = C - 1 // ERROR "constant definition loop\n.*B uses C\n.*C uses B"
+const C = A + B + 1
diff --git a/test/uintptrescapes.dir/a.go b/test/uintptrescapes.dir/a.go
new file mode 100644
index 0000000..29c8340
--- /dev/null
+++ b/test/uintptrescapes.dir/a.go
@@ -0,0 +1,54 @@
+// Copyright 2016 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
+
+import (
+ "unsafe"
+)
+
+func recurse(i int, s []byte) byte {
+ s[0] = byte(i)
+ if i == 0 {
+ return s[i]
+ } else {
+ var a [1024]byte
+ r := recurse(i-1, a[:])
+ return r + a[0]
+ }
+}
+
+//go:uintptrescapes
+func F1(a uintptr) {
+ var s [16]byte
+ recurse(4096, s[:])
+ *(*int)(unsafe.Pointer(a)) = 42
+}
+
+//go:uintptrescapes
+func F2(a ...uintptr) {
+ var s [16]byte
+ recurse(4096, s[:])
+ *(*int)(unsafe.Pointer(a[0])) = 42
+}
+
+type t struct{}
+
+func GetT() *t {
+ return &t{}
+}
+
+//go:uintptrescapes
+func (*t) M1(a uintptr) {
+ var s [16]byte
+ recurse(4096, s[:])
+ *(*int)(unsafe.Pointer(a)) = 42
+}
+
+//go:uintptrescapes
+func (*t) M2(a ...uintptr) {
+ var s [16]byte
+ recurse(4096, s[:])
+ *(*int)(unsafe.Pointer(a[0])) = 42
+}
diff --git a/test/uintptrescapes.dir/main.go b/test/uintptrescapes.dir/main.go
new file mode 100644
index 0000000..afda621
--- /dev/null
+++ b/test/uintptrescapes.dir/main.go
@@ -0,0 +1,91 @@
+// Copyright 2016 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 main
+
+import (
+ "fmt"
+ "os"
+ "sync"
+ "unsafe"
+
+ "./a"
+)
+
+func F1() int {
+ var buf [1024]int
+ a.F1(uintptr(unsafe.Pointer(&buf[0])))
+ return buf[0]
+}
+
+func F2() int {
+ var buf [1024]int
+ a.F2(uintptr(unsafe.Pointer(&buf[0])))
+ return buf[0]
+}
+
+var t = a.GetT()
+
+func M1() int {
+ var buf [1024]int
+ t.M1(uintptr(unsafe.Pointer(&buf[0])))
+ return buf[0]
+}
+
+func M2() int {
+ var buf [1024]int
+ t.M2(uintptr(unsafe.Pointer(&buf[0])))
+ return buf[0]
+}
+
+func main() {
+ // Use different goroutines to force stack growth.
+ var wg sync.WaitGroup
+ wg.Add(4)
+ c := make(chan bool, 4)
+
+ go func() {
+ defer wg.Done()
+ b := F1()
+ if b != 42 {
+ fmt.Printf("F1: got %d, expected 42\n", b)
+ c <- false
+ }
+ }()
+
+ go func() {
+ defer wg.Done()
+ b := F2()
+ if b != 42 {
+ fmt.Printf("F2: got %d, expected 42\n", b)
+ c <- false
+ }
+ }()
+
+ go func() {
+ defer wg.Done()
+ b := M1()
+ if b != 42 {
+ fmt.Printf("M1: got %d, expected 42\n", b)
+ c <- false
+ }
+ }()
+
+ go func() {
+ defer wg.Done()
+ b := M2()
+ if b != 42 {
+ fmt.Printf("M2: got %d, expected 42\n", b)
+ c <- false
+ }
+ }()
+
+ wg.Wait()
+
+ select {
+ case <-c:
+ os.Exit(1)
+ default:
+ }
+}
diff --git a/test/uintptrescapes.go b/test/uintptrescapes.go
new file mode 100644
index 0000000..554bb76
--- /dev/null
+++ b/test/uintptrescapes.go
@@ -0,0 +1,9 @@
+// rundir
+
+// Copyright 2016 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.
+
+// Test that the go:uintptrescapes comment works as expected.
+
+package ignored
diff --git a/test/uintptrescapes2.go b/test/uintptrescapes2.go
new file mode 100644
index 0000000..7ff676d
--- /dev/null
+++ b/test/uintptrescapes2.go
@@ -0,0 +1,31 @@
+// errorcheck -0 -m -live
+
+// Copyright 2016 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.
+
+// Test escape analysis and liveness inferred for uintptrescapes functions.
+
+package p
+
+import (
+ "unsafe"
+)
+
+//go:uintptrescapes
+//go:noinline
+func F1(a uintptr) {} // ERROR "escaping uintptr"
+
+//go:uintptrescapes
+//go:noinline
+func F2(a ...uintptr) {} // ERROR "escaping ...uintptr" "live at entry" "a does not escape"
+
+func G() {
+ var t int // ERROR "moved to heap"
+ F1(uintptr(unsafe.Pointer(&t))) // ERROR "live at call to F1: autotmp" "&t escapes to heap"
+}
+
+func H() {
+ var v int // ERROR "moved to heap"
+ F2(0, 1, uintptr(unsafe.Pointer(&v)), 2) // ERROR "live at call to newobject: autotmp" "live at call to F2: autotmp" "escapes to heap"
+}
diff --git a/test/undef.go b/test/undef.go
index 0a77e59..61524f3 100644
--- a/test/undef.go
+++ b/test/undef.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/varerr.go b/test/varerr.go
index 22aa932..82ab814 100644
--- a/test/varerr.go
+++ b/test/varerr.go
@@ -1,6 +1,6 @@
// errorcheck
-// Copyright 2010 The Go Authors. All rights reserved.
+// Copyright 2010 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.
diff --git a/test/writebarrier.go b/test/writebarrier.go
index 9b741a6..88b4b29 100644
--- a/test/writebarrier.go
+++ b/test/writebarrier.go
@@ -1,6 +1,6 @@
// errorcheck -0 -l -d=wb
-// Copyright 2015 The Go Authors. All rights reserved.
+// Copyright 2015 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.
@@ -144,3 +144,70 @@
func f16(x []T8, y T8) []T8 {
return append(x, y) // ERROR "write barrier"
}
+
+func t1(i interface{}) **int {
+ // From issue 14306, make sure we have write barriers in a type switch
+ // where the assigned variable escapes.
+ switch x := i.(type) { // ERROR "write barrier"
+ case *int:
+ return &x
+ }
+ switch y := i.(type) { // no write barrier here
+ case **int:
+ return y
+ }
+ return nil
+}
+
+type T17 struct {
+ f func(*T17)
+}
+
+func f17(x *T17) {
+ // See golang.org/issue/13901
+ x.f = f17 // no barrier
+ x.f = func(y *T17) { *y = *x } // ERROR "write barrier"
+}
+
+type T18 struct {
+ a []int
+ s string
+}
+
+func f18(p *T18, x *[]int) {
+ p.a = p.a[:5] // no barrier
+ *x = (*x)[0:5] // no barrier
+ p.a = p.a[3:5] // ERROR "write barrier"
+ p.a = p.a[1:2:3] // ERROR "write barrier"
+ p.s = p.s[8:9] // ERROR "write barrier"
+ *x = (*x)[3:5] // ERROR "write barrier"
+}
+
+func f19(x, y *int, i int) int {
+ // Constructing a temporary slice on the stack should not
+ // require any write barriers. See issue 14263.
+ a := []*int{x, y} // no barrier
+ return *a[i]
+}
+
+func f20(x, y *int, i int) []*int {
+ // ... but if that temporary slice escapes, then the
+ // write barriers are necessary.
+ a := []*int{x, y} // ERROR "write barrier"
+ return a
+}
+
+var x21 *int
+var y21 struct {
+ x *int
+}
+var z21 int
+
+func f21(x *int) {
+ // Global -> heap pointer updates must have write barriers.
+ x21 = x // ERROR "write barrier"
+ y21.x = x // ERROR "write barrier"
+ x21 = &z21 // no barrier
+ y21.x = &z21 // no barrier
+ y21 = struct{ x *int }{x} // ERROR "write barrier"
+}