Re: Go testsuite patch committed: Add some new tests

2020-12-16 Thread Ian Lance Taylor via Gcc-patches
And another set of new tests.  Bootstrapped and ran Go testsuite on
x86_64-pc-linux-gnu.  Committed to mainline.

Ian


patch.txt.bz2
Description: application/bzip


Re: Go testsuite patch committed: Add some new tests

2020-12-16 Thread Ian Lance Taylor via Gcc-patches
This patch adds some more new tests from the fixedbugs subdirectory of
the source repo that currently pass with gccgo.  Bootstrapped and ran
Go testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian


patch.txt.bz2
Description: application/bzip


Go testsuite patch committed: Add some new tests

2020-12-16 Thread Ian Lance Taylor via Gcc-patches
This patch adds some new tests from the fixedbugs subdirectory of the
source repo that currently pass with gccgo.  Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Ian
e38c912700f001ea1c8a32533bedb4c802e38d3f
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug13343.go 
b/gcc/testsuite/go.test/test/fixedbugs/bug13343.go
new file mode 100644
index 000..a7febeae7e0
--- /dev/null
+++ b/gcc/testsuite/go.test/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|depend 
upon each other"
+   c= b   // GCCGO_ERROR "depends upon itself|depend upon each other"
+)
+
+func f() (int, int) {
+   return c, c
+}
+
+func main() {}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug19403.go 
b/gcc/testsuite/go.test/test/fixedbugs/bug19403.go
new file mode 100644
index 000..94c0fb47309
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug19403.go
@@ -0,0 +1,134 @@
+// run
+
+// Copyright 2017 The Go 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 for golang.org/issue/19403.
+// F15 should not be clobbered by float-to-int conversion on ARM.
+// This test requires enough locals that can be put in registers that the 
compiler can choose to use F15.
+package main
+
+var count float32 = 16
+var i0 int
+var i1 int
+var i2 int
+var i3 int
+var i4 int
+var i5 int
+var i6 int
+var i7 int
+var i8 int
+var i9 int
+var i10 int
+var i11 int
+var i12 int
+var i13 int
+var i14 int
+var i15 int
+var i16 int
+
+func main() {
+   var f0 float32 = 0.0
+   var f1 float32 = 1.0
+   var f2 float32 = 2.0
+   var f3 float32 = 3.0
+   var f4 float32 = 4.0
+   var f5 float32 = 5.0
+   var f6 float32 = 6.0
+   var f7 float32 = 7.0
+   var f8 float32 = 8.0
+   var f9 float32 = 9.0
+   var f10 float32 = 10.0
+   var f11 float32 = 11.0
+   var f12 float32 = 12.0
+   var f13 float32 = 13.0
+   var f14 float32 = 14.0
+   var f15 float32 = 15.0
+   var f16 float32 = 16.0
+   i0 = int(f0)
+   i1 = int(f1)
+   i2 = int(f2)
+   i3 = int(f3)
+   i4 = int(f4)
+   i5 = int(f5)
+   i6 = int(f6)
+   i7 = int(f7)
+   i8 = int(f8)
+   i9 = int(f9)
+   i10 = int(f10)
+   i11 = int(f11)
+   i12 = int(f12)
+   i13 = int(f13)
+   i14 = int(f14)
+   i15 = int(f15)
+   i16 = int(f16)
+   if f16 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f15 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f14 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f13 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f12 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f11 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f10 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f9 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f8 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f7 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f6 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f5 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f4 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f3 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f2 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f1 != count {
+   panic("fail")
+   }
+   count -= 1
+   if f0 != count {
+   panic("fail")
+   }
+   count -= 1
+}
diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug369.dir/main.go 
b/gcc/testsuite/go.test/test/fixedbugs/bug369.dir/main.go
new file mode 100644
index 000..03b53a5b90d
--- /dev/null
+++ b/gcc/testsuite/go.test/test/fixedbugs/bug369.dir/main.go
@@ -0,0 +1,55 @@
+// 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.
+
+package main
+
+import (
+   "flag"
+   "os"
+   "runtime"
+   "testing"
+
+   fast "./fast"
+   slow "./slow"
+)
+
+var buf = make([]byte, 1048576)
+
+func BenchmarkFastNonASCII(b *testing.B) {
+   for i := 0; i < b.N; i++ {
+   fast.NonASCII(buf, 0)
+   }
+}
+
+func BenchmarkSlowNonASCII(b *testing.B) {
+   for i := 0; i < b.N; i++ {
+