From: Ian Lance Taylor Date: Thu, 3 Dec 2020 19:13:03 +0000 (-0800) Subject: Go testsuite: add a bunch of new tests from source repo X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=adbeeb198a2a00812a5cd2ff0a38d6243a590dd0;p=gcc.git Go testsuite: add a bunch of new tests from source repo --- diff --git a/gcc/testsuite/go.test/test/alias2.go b/gcc/testsuite/go.test/test/alias2.go new file mode 100644 index 00000000000..7ea1b2908dd --- /dev/null +++ b/gcc/testsuite/go.test/test/alias2.go @@ -0,0 +1,104 @@ +// 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 basic restrictions on type aliases. + +package p + +import ( + "reflect" + . "reflect" +) + +type T0 struct{} + +// Valid type alias declarations. + +type _ = T0 +type _ = int +type _ = struct{} +type _ = reflect.Value +type _ = Value + +type ( + A0 = T0 + A1 = int + A2 = struct{} + A3 = reflect.Value + A4 = Value + A5 = Value + + N0 A0 +) + +// Methods can be declared on the original named type and the alias. +func (T0) m1() {} // GCCGO_ERROR "previous" +func (*T0) m1() {} // ERROR "method redeclared: T0\.m1|redefinition of .m1." +func (A0) m1() {} // ERROR "T0\.m1 redeclared in this block|redefinition of .m1." +func (A0) m1() {} // ERROR "T0\.m1 redeclared in this block|redefinition of .m1." +func (A0) m2() {} + +// Type aliases and the original type name can be used interchangeably. +var _ A0 = T0{} +var _ T0 = A0{} + +// But aliases and original types cannot be used with new types based on them. +var _ N0 = T0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type" +var _ N0 = A0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type" + +var _ A5 = Value{} + +var _ interface { + m1() + m2() +} = T0{} + +var _ interface { + m1() + m2() +} = A0{} + +func _() { + type _ = T0 + type _ = int + type _ = struct{} + type _ = reflect.Value + type _ = Value + + type ( + A0 = T0 + A1 = int + A2 = struct{} + A3 = reflect.Value + A4 = Value + A5 Value + + N0 A0 + ) + + var _ A0 = T0{} + var _ T0 = A0{} + + var _ N0 = T0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type" + var _ N0 = A0{} // ERROR "cannot use T0 literal \(type T0\) as type N0 in assignment|incompatible type" + + var _ A5 = Value{} // ERROR "cannot use reflect\.Value literal \(type reflect.Value\) as type A5 in assignment|incompatible type" +} + +// Invalid type alias declarations. + +type _ = reflect.ValueOf // ERROR "reflect.ValueOf is not a type|expected type" + +func (A1) m() {} // ERROR "cannot define new methods on non-local type int|may not define methods on non-local type" +func (A2) m() {} // ERROR "invalid receiver type" +func (A3) m() {} // ERROR "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type" +func (A4) m() {} // ERROR "cannot define new methods on non-local type reflect.Value|may not define methods on non-local type" + +type B1 = struct{} + +func (B1) m() {} // ERROR "invalid receiver type" + +// TODO(gri) expand diff --git a/gcc/testsuite/go.test/test/alias3.dir/a.go b/gcc/testsuite/go.test/test/alias3.dir/a.go new file mode 100644 index 00000000000..09b3408d16c --- /dev/null +++ b/gcc/testsuite/go.test/test/alias3.dir/a.go @@ -0,0 +1,42 @@ +// 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. + +package a + +import "go/build" + +type ( + Float64 = float64 + Rune = rune +) + +type ( + Int int + IntAlias = Int + IntAlias2 = IntAlias + S struct { + Int + IntAlias + IntAlias2 + } +) + +type ( + Context = build.Context +) + +type ( + I1 interface { + M1(IntAlias2) Float64 + M2() Context + } + + I2 = interface { + M1(Int) float64 + M2() build.Context + } +) + +var i1 I1 +var i2 I2 = i1 diff --git a/gcc/testsuite/go.test/test/alias3.dir/b.go b/gcc/testsuite/go.test/test/alias3.dir/b.go new file mode 100644 index 00000000000..8a86cc06434 --- /dev/null +++ b/gcc/testsuite/go.test/test/alias3.dir/b.go @@ -0,0 +1,26 @@ +// 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. + +package b + +import ( + "./a" + . "go/build" +) + +func F(x float64) a.Float64 { + return x +} + +type MyContext = Context // = build.Context + +var C a.Context = Default + +type S struct{} + +func (S) M1(x a.IntAlias) float64 { return a.Float64(x) } +func (S) M2() Context { return Default } + +var _ a.I1 = S{} +var _ a.I2 = S{} diff --git a/gcc/testsuite/go.test/test/alias3.dir/c.go b/gcc/testsuite/go.test/test/alias3.dir/c.go new file mode 100644 index 00000000000..161d5934c25 --- /dev/null +++ b/gcc/testsuite/go.test/test/alias3.dir/c.go @@ -0,0 +1,25 @@ +// 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. + +package main + +import ( + "./a" + "./b" +) + +func main() { + var _ float64 = b.F(0) + var _ a.Rune = int32(0) + + // embedded types can have different names but the same types + var s a.S + s.Int = 1 + s.IntAlias = s.Int + s.IntAlias2 = s.Int + + // aliases denote identical types across packages + var c a.Context = b.C + var _ b.MyContext = c +} diff --git a/gcc/testsuite/go.test/test/alias3.go b/gcc/testsuite/go.test/test/alias3.go new file mode 100644 index 00000000000..c3732c311b7 --- /dev/null +++ b/gcc/testsuite/go.test/test/alias3.go @@ -0,0 +1,7 @@ +// rundir + +// 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. + +package ignored diff --git a/gcc/testsuite/go.test/test/chan/select8.go b/gcc/testsuite/go.test/test/chan/select8.go new file mode 100644 index 00000000000..20bca3a0f97 --- /dev/null +++ b/gcc/testsuite/go.test/test/chan/select8.go @@ -0,0 +1,55 @@ +// run + +// Copyright 2019 The Go 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 break statements in a select. +// Gccgo had a bug in handling this. +// Test 1,2,3-case selects, so it covers both the general +// code path and the specialized optimizations for one- +// and two-case selects. + +package main + +var ch = make(chan int) + +func main() { + go func() { + for { + ch <- 5 + } + }() + + select { + case <-ch: + break + panic("unreachable") + } + + select { + default: + break + panic("unreachable") + } + + select { + case <-ch: + break + panic("unreachable") + default: + break + panic("unreachable") + } + + select { + case <-ch: + break + panic("unreachable") + case ch <- 10: + panic("unreachable") + default: + break + panic("unreachable") + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug487.go b/gcc/testsuite/go.test/test/fixedbugs/bug487.go new file mode 100644 index 00000000000..eb1ad5e571a --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug487.go @@ -0,0 +1,24 @@ +// errorcheck + +// 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. + +// The gccgo compiler did not reliably report mismatches between the +// number of function results and the number of expected results. + +package p + +func G() (int, int, int) { + return 0, 0, 0 +} + +func F() { + a, b := G() // ERROR "mismatch" + a, b = G() // ERROR "mismatch" + _, _ = a, b +} + +func H() (int, int) { + return G() // ERROR "too many|mismatch" +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug488.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug488.dir/a.go new file mode 100644 index 00000000000..94eaf7f1ea8 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug488.dir/a.go @@ -0,0 +1,7 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +var p2 = Printf // ERROR "undefined" diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug488.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/bug488.dir/b.go new file mode 100644 index 00000000000..21b4c5b541a --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug488.dir/b.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +import . "fmt" + +var p1 = Print diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug488.go b/gcc/testsuite/go.test/test/fixedbugs/bug488.go new file mode 100644 index 00000000000..63a601ed934 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug488.go @@ -0,0 +1,12 @@ +// errorcheckdir + +// 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. + +// The gccgo compiler had a bug: if one file in a package did a dot +// import, then an earlier file in the package would incorrectly +// resolve to the imported names rather than reporting undefined +// errors. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/a.go new file mode 100644 index 00000000000..21b4c5b541a --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/a.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +import . "fmt" + +var p1 = Print diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/b.go new file mode 100644 index 00000000000..63eab86999e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/b.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +import "fmt" + +var p2 = fmt.Printf diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/c.go new file mode 100644 index 00000000000..d5588013755 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug489.dir/c.go @@ -0,0 +1,9 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +import . "fmt" + +var p3 = Println diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug489.go b/gcc/testsuite/go.test/test/fixedbugs/bug489.go new file mode 100644 index 00000000000..bf5e2cdbd35 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug489.go @@ -0,0 +1,12 @@ +// compiledir + +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// The gccgo compiler had a bug: if one file in a package did a dot +// import, then an earlier file in the package would incorrectly +// resolve to the imported names rather than reporting undefined +// errors. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug492.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug492.dir/a.go new file mode 100644 index 00000000000..90917e55e83 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug492.dir/a.go @@ -0,0 +1,16 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package a + +type s struct { + s string +} + +func F1(s s) { +} + +func F2() s { + return s{""} +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug492.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/bug492.dir/b.go new file mode 100644 index 00000000000..5b8c4f2a533 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug492.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2014 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package main + +import "./a" + +func main() { + defer a.F1(a.F2()) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug492.go b/gcc/testsuite/go.test/test/fixedbugs/bug492.go new file mode 100644 index 00000000000..050a9e5ee20 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug492.go @@ -0,0 +1,9 @@ +// rundir + +// 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. + +// Test case that gccgo failed to link. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug493.go b/gcc/testsuite/go.test/test/fixedbugs/bug493.go new file mode 100644 index 00000000000..643e9af4b8e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug493.go @@ -0,0 +1,15 @@ +// compile + +// 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. + +// Test case that gccgo failed to compile. + +package p + +func F() []string { + return []string{""} +} + +var V = append(F()) diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug494.go b/gcc/testsuite/go.test/test/fixedbugs/bug494.go new file mode 100644 index 00000000000..42f18797f78 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug494.go @@ -0,0 +1,51 @@ +// 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. + +// Gccgo incorrectly executed functions multiple times when they +// appeared in a composite literal that required a conversion between +// different interface types. + +package main + +type MyInt int + +var c MyInt + +func (c *MyInt) S(i int) { + *c = MyInt(i) +} + +func (c *MyInt) V() int { + return int(*c) +} + +type i1 interface { + S(int) + V() int +} + +type i2 interface { + V() int +} + +type s struct { + i i2 +} + +func f() i1 { + c++ + return &c +} + +func main() { + p := &s{f()} + if v := p.i.V(); v != 1 { + panic(v) + } + if c != 1 { + panic(c) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug496.go b/gcc/testsuite/go.test/test/fixedbugs/bug496.go new file mode 100644 index 00000000000..4307c75e83a --- /dev/null +++ b/gcc/testsuite/go.test/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: +// : error: redefinition of ‘s$F$hash’ +// : note: previous definition of ‘s$F$hash’ was here +// : error: redefinition of ‘s$F$equal’ +// : 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/gcc/testsuite/go.test/test/fixedbugs/bug497.go b/gcc/testsuite/go.test/test/fixedbugs/bug497.go new file mode 100644 index 00000000000..661cfacd791 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug497.go @@ -0,0 +1,27 @@ +// 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 this, because of the empty struct. + +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/gcc/testsuite/go.test/test/fixedbugs/bug499.go b/gcc/testsuite/go.test/test/fixedbugs/bug499.go new file mode 100644 index 00000000000..e4142e935bd --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug499.go @@ -0,0 +1,15 @@ +// 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. + +// Gccgo got confused when a type was used both for a map bucket type +// and for a map key type. + +package main + +func main() { + _ = make(map[byte]byte) + _ = make(map[[8]byte]chan struct{}) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug500.go b/gcc/testsuite/go.test/test/fixedbugs/bug500.go new file mode 100644 index 00000000000..2dd5df13b0c --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug500.go @@ -0,0 +1,41 @@ +// 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. + +// Gccgo generated incorrect GC info when a global variable was +// initialized to a slice of a value containing pointers. The initial +// backing array for the slice was allocated in the .data section, +// which is fine, but the backing array was not registered as a GC +// root. + +package main + +import ( + "runtime" +) + +type s struct { + str string +} + +var a = []struct { + str string +}{ + {""}, +} + +var b = "b" +var c = "c" + +func init() { + a[0].str = b + c +} + +func main() { + runtime.GC() + if a[0].str != b + c { + panic(a[0].str) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug501.go b/gcc/testsuite/go.test/test/fixedbugs/bug501.go new file mode 100644 index 00000000000..8e951b18c8e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug501.go @@ -0,0 +1,24 @@ +// 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. + +// Gccgo got a compiler crash compiling the addition of more than five +// strings with mixed constants and variables. + +package main + +func F(s string) (string, error) { + return s, nil +} + +func G(a, b, c string) (string, error) { + return F("a" + a + "b" + b + "c" + c) +} + +func main() { + if got, _ := G("x", "y", "z"); got != "axbycz" { + panic(got) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug502.go b/gcc/testsuite/go.test/test/fixedbugs/bug502.go new file mode 100644 index 00000000000..cff73e7d7fe --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug502.go @@ -0,0 +1,28 @@ +// build + +// 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. + +// Linking this with gccgo got an undefined symbol reference, +// because the private method in testing.TB led gccgo to assume that +// the interface method table would be defined in the testing package. + +package main + +import "testing" + +type I interface { + testing.TB + Parallel() +} + +func F(i I) { + i.Log("F") +} + +var t testing.T + +func main() { + F(&t) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug503.go b/gcc/testsuite/go.test/test/fixedbugs/bug503.go new file mode 100644 index 00000000000..7bbc7981c5e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug503.go @@ -0,0 +1,16 @@ +// compile + +// 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. + +// gccgo crashed compiling this file, due to failing to correctly emit +// the type descriptor for a named alias. + +package p + +type entry = struct { + a, b, c int +} + +var V entry diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/a.go new file mode 100644 index 00000000000..ac0be937ab2 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/a.go @@ -0,0 +1,7 @@ +// 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. + +package a + +type MyInt = int diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/b.go new file mode 100644 index 00000000000..e8f8da9af88 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/b.go @@ -0,0 +1,11 @@ +// 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. + +package b + +import "./a" + +func F() a.MyInt { + return 0 +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/c.go new file mode 100644 index 00000000000..5a6e8899059 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/c.go @@ -0,0 +1,9 @@ +// 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. + +package c + +import "./b" + +var V = b.F() diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/main.go new file mode 100644 index 00000000000..bdbd95c7a31 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug504.dir/main.go @@ -0,0 +1,11 @@ +// 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. + +package main + +import "./c" + +func main() { + println(c.V) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug504.go b/gcc/testsuite/go.test/test/fixedbugs/bug504.go new file mode 100644 index 00000000000..ae1f2e52d8e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug504.go @@ -0,0 +1,10 @@ +// compiledir + +// 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. + +// Gccgo mishandled a reference to a type alias in a package that was +// not directly imported. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug505.go b/gcc/testsuite/go.test/test/fixedbugs/bug505.go new file mode 100644 index 00000000000..062a0871688 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug505.go @@ -0,0 +1,20 @@ +// compile + +// 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. + +// gccgo crashed compiling this file with a failed conversion to the +// alias type when constructing the composite literal. + +package p + +type I interface{ M() } +type A = I +type S struct { + f A +} + +func F(i I) S { + return S{f: i} +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug506.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug506.dir/a.go new file mode 100644 index 00000000000..2729b81ac68 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug506.dir/a.go @@ -0,0 +1,16 @@ +// 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. + +package a + +type internal struct { + f1 string + f2 float64 +} + +type S struct { + F struct { + I internal + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug506.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/bug506.dir/main.go new file mode 100644 index 00000000000..f54c95d3203 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug506.dir/main.go @@ -0,0 +1,20 @@ +// 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. + +package main + +import ( + "fmt" + + "./a" +) + +var v = a.S{} + +func main() { + want := "{{ 0}}" + if got := fmt.Sprint(v.F); got != want { + panic(got) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug506.go b/gcc/testsuite/go.test/test/fixedbugs/bug506.go new file mode 100644 index 00000000000..3ca09ad0ecc --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug506.go @@ -0,0 +1,10 @@ +// rundir + +// 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. + +// Gccgo caused an undefined symbol reference building hash functions +// for an imported struct with unexported fields. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/a.go new file mode 100644 index 00000000000..59d494281d0 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/a.go @@ -0,0 +1,13 @@ +// Copyright 2019 The Go 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 I interface { + M() +} + +type S struct { + I I +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/b.go new file mode 100644 index 00000000000..6e4196412ff --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/b.go @@ -0,0 +1,9 @@ +// Copyright 2019 The Go 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 V2 I diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/c.go new file mode 100644 index 00000000000..23846ed88a7 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug507.dir/c.go @@ -0,0 +1,9 @@ +// Copyright 2019 The Go 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 V1 = a.S{I: nil} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug507.go b/gcc/testsuite/go.test/test/fixedbugs/bug507.go new file mode 100644 index 00000000000..48547b09be7 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug507.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 mishandled a combination of normal import and dot import. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug508.go b/gcc/testsuite/go.test/test/fixedbugs/bug508.go new file mode 100644 index 00000000000..69b1adaf959 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug508.go @@ -0,0 +1,14 @@ +// compile + +// Copyright 2020 The Go 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 mishandles composite literals of map with type bool. + +package p + +var M = map[bool]uint8{ + false: 0, + true: 1, +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/bug509.go b/gcc/testsuite/go.test/test/fixedbugs/bug509.go new file mode 100644 index 00000000000..df6ed61f893 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/bug509.go @@ -0,0 +1,30 @@ +// compile + +// Copyright 2020 The Go 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 mishandles a couple of alias cases. + +package p + +type S struct{} + +func (*S) M() {} + +type I interface { + M() +} + +type A = *S + +var V1 I +var _ = V1.(*S) +var _ = V1.(A) + +func F() { + var v I + v = (*S)(nil) + v = A(nil) + _ = v +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc67968.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/gcc67968.dir/a.go new file mode 100644 index 00000000000..b557b2f1614 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/gcc67968.dir/a.go @@ -0,0 +1,8 @@ +package a + +type T int + +func (a *T) Foo() [1]string { + var r [1]string + return r +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc67968.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/gcc67968.dir/b.go new file mode 100644 index 00000000000..4362b441260 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/gcc67968.dir/b.go @@ -0,0 +1,8 @@ +package b + +import "./a" + +func F() (interface{}) { + var v *a.T + return v.Foo() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc67968.go b/gcc/testsuite/go.test/test/fixedbugs/gcc67968.go new file mode 100644 index 00000000000..8db3dd8a511 --- /dev/null +++ b/gcc/testsuite/go.test/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/gcc/testsuite/go.test/test/fixedbugs/gcc78763.go b/gcc/testsuite/go.test/test/fixedbugs/gcc78763.go new file mode 100644 index 00000000000..3e3412753ec --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/gcc78763.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. + +// The gccgo compiler crashed while compiling this code. +// https://gcc.gnu.org/PR78763. + +package p + +import "unsafe" + +func F() int { + if unsafe.Sizeof(0) == 8 { + return 8 + } + return 0 +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc80226.go b/gcc/testsuite/go.test/test/fixedbugs/gcc80226.go new file mode 100644 index 00000000000..530b397f0f9 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/gcc80226.go @@ -0,0 +1,17 @@ +// compile + +// 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. + +// The gccgo compiler crashed while compiling a function that returned +// multiple zero-sized structs. +// https://gcc.gnu.org/PR80226. + +package p + +type S struct{} + +func F() (S, S) { + return S{}, S{} +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/gcc89321.go b/gcc/testsuite/go.test/test/fixedbugs/gcc89321.go new file mode 100644 index 00000000000..93ca6b40a51 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/gcc89321.go @@ -0,0 +1,17 @@ +// compile + +// Copyright 2019 The Go 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/PR89321 +// gccgo compiler crash building map literals with a zero-sized value type. + +package p + +type M map[byte]struct{} + +var ( + M1 = M{1: {}, 2: {}, 3: {}} + M2 = M{1: {}, 2: {}} +) diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue12621.go b/gcc/testsuite/go.test/test/fixedbugs/issue12621.go new file mode 100644 index 00000000000..379a362d73b --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue12621.go @@ -0,0 +1,20 @@ +// run + +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issues 12576 and 12621: Negative untyped floating point constants +// with small magnitude round to 0, not negative zero. + +package main + +import "math" + +var m = -1e-10000 + +func main() { + if math.Signbit(m) { + panic(m) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue14540.go b/gcc/testsuite/go.test/test/fixedbugs/issue14540.go new file mode 100644 index 00000000000..62b17a04c48 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue14540.go @@ -0,0 +1,20 @@ +// errorcheck + +// 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. + +package p + +func f(x int) { + switch x { + case 0: + fallthrough + ; // ok + case 1: + fallthrough // ERROR "fallthrough statement out of place" + {} + case 2: + fallthrough // ERROR "cannot fallthrough" + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue15002.go b/gcc/testsuite/go.test/test/fixedbugs/issue15002.go new file mode 100644 index 00000000000..936105ed126 --- /dev/null +++ b/gcc/testsuite/go.test/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 [1] with length 1" { + 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 [1] with length 1" { + 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 [1] with length 1" { + 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 [1] with length 1" { + 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 [1] with length 1" { + 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 [1] with length 1" { + 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/gcc/testsuite/go.test/test/fixedbugs/issue16949.go b/gcc/testsuite/go.test/test/fixedbugs/issue16949.go new file mode 100644 index 00000000000..9ee3387e969 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue16949.go @@ -0,0 +1,30 @@ +// 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. + +// Ensure that typed non-integer len and cap make arguments are not accepted. + +package main + +var sink []byte + +func main() { + sink = make([]byte, 1.0) + sink = make([]byte, float32(1.0)) // ERROR "non-integer.*len" + sink = make([]byte, float64(1.0)) // ERROR "non-integer.*len" + + sink = make([]byte, 0, 1.0) + sink = make([]byte, 0, float32(1.0)) // ERROR "non-integer.*cap" + sink = make([]byte, 0, float64(1.0)) // ERROR "non-integer.*cap" + + sink = make([]byte, 1+0i) + sink = make([]byte, complex64(1+0i)) // ERROR "non-integer.*len" + sink = make([]byte, complex128(1+0i)) // ERROR "non-integer.*len" + + sink = make([]byte, 0, 1+0i) + sink = make([]byte, 0, complex64(1+0i)) // ERROR "non-integer.*cap" + sink = make([]byte, 0, complex128(1+0i)) // ERROR "non-integer.*cap" + +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue19113.go b/gcc/testsuite/go.test/test/fixedbugs/issue19113.go new file mode 100644 index 00000000000..5e01dde699c --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue19113.go @@ -0,0 +1,108 @@ +// run + +// Copyright 2019 The Go 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" + +var tests = []interface{}{ + func(x int, s int) int { + return x << s + }, + func(x int, s int64) int { + return x << s + }, + func(x int, s int32) int { + return x << s + }, + func(x int, s int16) int { + return x << s + }, + func(x int, s int8) int { + return x << s + }, + func(x int, s int) int { + return x >> s + }, + func(x int, s int64) int { + return x >> s + }, + func(x int, s int32) int { + return x >> s + }, + func(x int, s int16) int { + return x >> s + }, + func(x int, s int8) int { + return x >> s + }, + func(x uint, s int) uint { + return x << s + }, + func(x uint, s int64) uint { + return x << s + }, + func(x uint, s int32) uint { + return x << s + }, + func(x uint, s int16) uint { + return x << s + }, + func(x uint, s int8) uint { + return x << s + }, + func(x uint, s int) uint { + return x >> s + }, + func(x uint, s int64) uint { + return x >> s + }, + func(x uint, s int32) uint { + return x >> s + }, + func(x uint, s int16) uint { + return x >> s + }, + func(x uint, s int8) uint { + return x >> s + }, +} + +func main() { + for _, t := range tests { + runTest(reflect.ValueOf(t)) + } +} + +func runTest(f reflect.Value) { + xt := f.Type().In(0) + st := f.Type().In(1) + + for _, x := range []int{1, 0, -1} { + for _, s := range []int{-99, -64, -63, -32, -31, -16, -15, -8, -7, -1, 0, 1, 7, 8, 15, 16, 31, 32, 63, 64, 99} { + args := []reflect.Value{ + reflect.ValueOf(x).Convert(xt), + reflect.ValueOf(s).Convert(st), + } + if s < 0 { + shouldPanic(func() { + f.Call(args) + }) + } else { + f.Call(args) // should not panic + } + } + } +} + +func shouldPanic(f func()) { + defer func() { + if recover() == nil { + panic("did not panic") + } + }() + f() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue20923.go b/gcc/testsuite/go.test/test/fixedbugs/issue20923.go new file mode 100644 index 00000000000..5fd1ad8a46b --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue20923.go @@ -0,0 +1,19 @@ +// compile + +// Copyright 2018 The Go 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 20923: gccgo failed to compile parenthesized select case expressions. + +package p + +func F(c chan bool) { + select { + case (<-c): + case _ = (<-c): + case _, _ = (<-c): + case (c) <- true: + default: + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue21253.go b/gcc/testsuite/go.test/test/fixedbugs/issue21253.go new file mode 100644 index 00000000000..3531b2b81fd --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue21253.go @@ -0,0 +1,27 @@ +// compile + +// 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. + +// Gccgo crashed compiling this code due to failing to finalize +// interfaces in the right order. + +package p + +type s1 struct { + f m + I +} + +type m interface { + Mm(*s2) +} + +type s2 struct { + *s1 +} + +type I interface { + MI() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue22305.go b/gcc/testsuite/go.test/test/fixedbugs/issue22305.go new file mode 100644 index 00000000000..ec432f9ae89 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue22305.go @@ -0,0 +1,15 @@ +// compile + +// 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. + +// Issue 22305: gccgo failed to compile this file. + +package main + +var F func() [0]func() +var i = 2 +var B = F()[i] + +func main() {} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23188.go b/gcc/testsuite/go.test/test/fixedbugs/issue23188.go new file mode 100644 index 00000000000..af005656d27 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue23188.go @@ -0,0 +1,32 @@ +// run + +// Copyright 2018 The Go 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 order of evaluation of index operations. + +package main + +func main() { + arr := []int{1, 2} + + // The spec says that in an assignment statement the operands + // of all index expressions and pointer indirections on the + // left, and the expressions on the right, are evaluated in + // the usual order. The usual order means function calls and + // channel operations are done first. Then the assignments are + // carried out one at a time. The operands of an index + // expression include both the array and the index. So this + // evaluates as + // tmp1 := arr + // tmp2 := len(arr) - 1 + // tmp3 := len(arr) + // arr = arr[:tmp3-1] + // tmp1[tmp2] = 3 + arr, arr[len(arr)-1] = arr[:len(arr)-1], 3 + + if len(arr) != 1 || arr[0] != 1 || arr[:2][1] != 3 { + panic(arr) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23489.go b/gcc/testsuite/go.test/test/fixedbugs/issue23489.go new file mode 100644 index 00000000000..1e64af1903a --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue23489.go @@ -0,0 +1,20 @@ +// 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. + +// Caused gccgo to issue a spurious compilation error. + +package main + +type T struct{} + +func (*T) Foo() {} + +type P = *T + +func main() { + var p P + p.Foo() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue23912.go b/gcc/testsuite/go.test/test/fixedbugs/issue23912.go new file mode 100644 index 00000000000..05ffd6be298 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue23912.go @@ -0,0 +1,30 @@ +// compile + +// Copyright 2018 The Go 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 couple of aliases cases that gccgo incorrectly gave errors for. + +package p + +func F1() { + type E = struct{} + type X struct{} + var x X + var y E = x + _ = y +} + +func F2() { + type E = struct{} + type S []E + type T []struct{} + type X struct{} + var x X + s := S{E{}} + t := T{struct{}{}} + _ = append(s, x) + _ = append(s, t[0]) + _ = append(s, t...) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26335.go b/gcc/testsuite/go.test/test/fixedbugs/issue26335.go new file mode 100644 index 00000000000..a97b4b6c72c --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue26335.go @@ -0,0 +1,32 @@ +// run + +// Copyright 2018 The Go 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 mishandled passing a struct with an empty field through +// reflect.Value.Call. + +package main + +import ( + "reflect" +) + +type Empty struct { + f1, f2 *byte + empty struct{} +} + +func F(e Empty, s []string) { + if len(s) != 1 || s[0] != "hi" { + panic("bad slice") + } +} + +func main() { + reflect.ValueOf(F).Call([]reflect.Value{ + reflect.ValueOf(Empty{}), + reflect.ValueOf([]string{"hi"}), + }) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue26340.go b/gcc/testsuite/go.test/test/fixedbugs/issue26340.go new file mode 100644 index 00000000000..cbacd84f489 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue26340.go @@ -0,0 +1,21 @@ +// compile + +// Copyright 2018 The Go 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 did not permit omitting the type of a composite literal +// element when the element type is a pointer type. + +package p + +type S []T +type T struct { x int } + +var _ = map[string]*S{ + "a": { + { 1 }, + }, +} + +var _ = [1]*S{ { {1}, } } diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue28601.go b/gcc/testsuite/go.test/test/fixedbugs/issue28601.go new file mode 100644 index 00000000000..ec367e9282d --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue28601.go @@ -0,0 +1,15 @@ +// compile + +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Failed to compile with gccgo. + +package p + +import "unsafe" + +const w int = int(unsafe.Sizeof(0)) + +var a [w]byte diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30116.go b/gcc/testsuite/go.test/test/fixedbugs/issue30116.go new file mode 100644 index 00000000000..452a6e3ae80 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30116.go @@ -0,0 +1,112 @@ +// run + +// Copyright 2019 The Go 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 the text output for bounds check failures is as expected. + +package main + +import ( + "fmt" + "os" + "runtime" + "text/tabwriter" +) + +// Testing with length 3 slices, arrays, and strings. +// Large (>1<<32) values are included to test 32-bit platforms. +var indexes = []int64{-9876543210, -1, 0, 2, 3, 9876543210} +var slices = []int64{-9876543210, -1, 0, 3, 4, 9876543210} + +var w *tabwriter.Writer + +func main() { + w = tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.AlignRight) + defer w.Flush() + doIndex() + doSlice() + doSlice3() +} +func doIndex() { + a := []int{1, 2, 3} + for _, i := range indexes { + printPanic(fmt.Sprintf("slice[%d]", i), func() { + _ = a[i] + }) + } + b := [3]int{1, 2, 3} + for _, i := range indexes { + printPanic(fmt.Sprintf("array[%d]", i), func() { + _ = b[i] + }) + } + c := "123" + for _, i := range indexes { + printPanic(fmt.Sprintf("string[%d]", i), func() { + _ = c[i] + }) + } +} + +func doSlice() { + a := []int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + printPanic(fmt.Sprintf("slice[%d:%d]", i, j), func() { + _ = a[i:j] + }) + } + } + b := [3]int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + printPanic(fmt.Sprintf("array[%d:%d]", i, j), func() { + _ = b[i:j] + }) + } + } + c := "123" + for _, i := range slices { + for _, j := range slices { + printPanic(fmt.Sprintf("string[%d:%d]", i, j), func() { + _ = c[i:j] + }) + } + } +} + +func doSlice3() { + a := []int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + for _, k := range slices { + printPanic(fmt.Sprintf("slice[%d:%d:%d]", i, j, k), func() { + _ = a[i:j:k] + }) + } + } + } + b := [3]int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + for _, k := range slices { + printPanic(fmt.Sprintf("array[%d:%d:%d]", i, j, k), func() { + _ = b[i:j:k] + }) + } + } + } +} + +func printPanic(msg string, f func()) { + defer func() { + res := "no panic" + if e := recover(); e != nil { + res = e.(runtime.Error).Error() + } + fmt.Fprintf(w, "%s\t %s\n", msg, res) + }() + f() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30116.out b/gcc/testsuite/go.test/test/fixedbugs/issue30116.out new file mode 100644 index 00000000000..bde134d9509 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30116.out @@ -0,0 +1,558 @@ + slice[-9876543210] runtime error: index out of range [-9876543210] + slice[-1] runtime error: index out of range [-1] + slice[0] no panic + slice[2] no panic + slice[3] runtime error: index out of range [3] with length 3 + slice[9876543210] runtime error: index out of range [9876543210] with length 3 + array[-9876543210] runtime error: index out of range [-9876543210] + array[-1] runtime error: index out of range [-1] + array[0] no panic + array[2] no panic + array[3] runtime error: index out of range [3] with length 3 + array[9876543210] runtime error: index out of range [9876543210] with length 3 + string[-9876543210] runtime error: index out of range [-9876543210] + string[-1] runtime error: index out of range [-1] + string[0] no panic + string[2] no panic + string[3] runtime error: index out of range [3] with length 3 + string[9876543210] runtime error: index out of range [9876543210] with length 3 + slice[-9876543210:-9876543210] runtime error: slice bounds out of range [:-9876543210] + slice[-9876543210:-1] runtime error: slice bounds out of range [:-1] + slice[-9876543210:0] runtime error: slice bounds out of range [-9876543210:] + slice[-9876543210:3] runtime error: slice bounds out of range [-9876543210:] + slice[-9876543210:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[-9876543210:9876543210] runtime error: slice bounds out of range [:9876543210] with capacity 3 + slice[-1:-9876543210] runtime error: slice bounds out of range [:-9876543210] + slice[-1:-1] runtime error: slice bounds out of range [:-1] + slice[-1:0] runtime error: slice bounds out of range [-1:] + slice[-1:3] runtime error: slice bounds out of range [-1:] + slice[-1:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[-1:9876543210] runtime error: slice bounds out of range [:9876543210] with capacity 3 + slice[0:-9876543210] runtime error: slice bounds out of range [:-9876543210] + slice[0:-1] runtime error: slice bounds out of range [:-1] + slice[0:0] no panic + slice[0:3] no panic + slice[0:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[0:9876543210] runtime error: slice bounds out of range [:9876543210] with capacity 3 + slice[3:-9876543210] runtime error: slice bounds out of range [:-9876543210] + slice[3:-1] runtime error: slice bounds out of range [:-1] + slice[3:0] runtime error: slice bounds out of range [3:0] + slice[3:3] no panic + slice[3:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[3:9876543210] runtime error: slice bounds out of range [:9876543210] with capacity 3 + slice[4:-9876543210] runtime error: slice bounds out of range [:-9876543210] + slice[4:-1] runtime error: slice bounds out of range [:-1] + slice[4:0] runtime error: slice bounds out of range [4:0] + slice[4:3] runtime error: slice bounds out of range [4:3] + slice[4:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[4:9876543210] runtime error: slice bounds out of range [:9876543210] with capacity 3 + slice[9876543210:-9876543210] runtime error: slice bounds out of range [:-9876543210] + slice[9876543210:-1] runtime error: slice bounds out of range [:-1] + slice[9876543210:0] runtime error: slice bounds out of range [9876543210:0] + slice[9876543210:3] runtime error: slice bounds out of range [9876543210:3] + slice[9876543210:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[9876543210:9876543210] runtime error: slice bounds out of range [:9876543210] with capacity 3 + array[-9876543210:-9876543210] runtime error: slice bounds out of range [:-9876543210] + array[-9876543210:-1] runtime error: slice bounds out of range [:-1] + array[-9876543210:0] runtime error: slice bounds out of range [-9876543210:] + array[-9876543210:3] runtime error: slice bounds out of range [-9876543210:] + array[-9876543210:4] runtime error: slice bounds out of range [:4] with length 3 + array[-9876543210:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + array[-1:-9876543210] runtime error: slice bounds out of range [:-9876543210] + array[-1:-1] runtime error: slice bounds out of range [:-1] + array[-1:0] runtime error: slice bounds out of range [-1:] + array[-1:3] runtime error: slice bounds out of range [-1:] + array[-1:4] runtime error: slice bounds out of range [:4] with length 3 + array[-1:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + array[0:-9876543210] runtime error: slice bounds out of range [:-9876543210] + array[0:-1] runtime error: slice bounds out of range [:-1] + array[0:0] no panic + array[0:3] no panic + array[0:4] runtime error: slice bounds out of range [:4] with length 3 + array[0:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + array[3:-9876543210] runtime error: slice bounds out of range [:-9876543210] + array[3:-1] runtime error: slice bounds out of range [:-1] + array[3:0] runtime error: slice bounds out of range [3:0] + array[3:3] no panic + array[3:4] runtime error: slice bounds out of range [:4] with length 3 + array[3:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + array[4:-9876543210] runtime error: slice bounds out of range [:-9876543210] + array[4:-1] runtime error: slice bounds out of range [:-1] + array[4:0] runtime error: slice bounds out of range [4:0] + array[4:3] runtime error: slice bounds out of range [4:3] + array[4:4] runtime error: slice bounds out of range [:4] with length 3 + array[4:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + array[9876543210:-9876543210] runtime error: slice bounds out of range [:-9876543210] + array[9876543210:-1] runtime error: slice bounds out of range [:-1] + array[9876543210:0] runtime error: slice bounds out of range [9876543210:0] + array[9876543210:3] runtime error: slice bounds out of range [9876543210:3] + array[9876543210:4] runtime error: slice bounds out of range [:4] with length 3 + array[9876543210:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + string[-9876543210:-9876543210] runtime error: slice bounds out of range [:-9876543210] + string[-9876543210:-1] runtime error: slice bounds out of range [:-1] + string[-9876543210:0] runtime error: slice bounds out of range [-9876543210:] + string[-9876543210:3] runtime error: slice bounds out of range [-9876543210:] + string[-9876543210:4] runtime error: slice bounds out of range [:4] with length 3 + string[-9876543210:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + string[-1:-9876543210] runtime error: slice bounds out of range [:-9876543210] + string[-1:-1] runtime error: slice bounds out of range [:-1] + string[-1:0] runtime error: slice bounds out of range [-1:] + string[-1:3] runtime error: slice bounds out of range [-1:] + string[-1:4] runtime error: slice bounds out of range [:4] with length 3 + string[-1:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + string[0:-9876543210] runtime error: slice bounds out of range [:-9876543210] + string[0:-1] runtime error: slice bounds out of range [:-1] + string[0:0] no panic + string[0:3] no panic + string[0:4] runtime error: slice bounds out of range [:4] with length 3 + string[0:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + string[3:-9876543210] runtime error: slice bounds out of range [:-9876543210] + string[3:-1] runtime error: slice bounds out of range [:-1] + string[3:0] runtime error: slice bounds out of range [3:0] + string[3:3] no panic + string[3:4] runtime error: slice bounds out of range [:4] with length 3 + string[3:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + string[4:-9876543210] runtime error: slice bounds out of range [:-9876543210] + string[4:-1] runtime error: slice bounds out of range [:-1] + string[4:0] runtime error: slice bounds out of range [4:0] + string[4:3] runtime error: slice bounds out of range [4:3] + string[4:4] runtime error: slice bounds out of range [:4] with length 3 + string[4:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + string[9876543210:-9876543210] runtime error: slice bounds out of range [:-9876543210] + string[9876543210:-1] runtime error: slice bounds out of range [:-1] + string[9876543210:0] runtime error: slice bounds out of range [9876543210:0] + string[9876543210:3] runtime error: slice bounds out of range [9876543210:3] + string[9876543210:4] runtime error: slice bounds out of range [:4] with length 3 + string[9876543210:9876543210] runtime error: slice bounds out of range [:9876543210] with length 3 + slice[-9876543210:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-9876543210:-9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[-9876543210:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + slice[-9876543210:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + slice[-9876543210:-9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-9876543210:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-9876543210:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-9876543210:-1:-1] runtime error: slice bounds out of range [::-1] + slice[-9876543210:-1:0] runtime error: slice bounds out of range [:-1:] + slice[-9876543210:-1:3] runtime error: slice bounds out of range [:-1:] + slice[-9876543210:-1:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-9876543210:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-9876543210:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-9876543210:0:-1] runtime error: slice bounds out of range [::-1] + slice[-9876543210:0:0] runtime error: slice bounds out of range [-9876543210::] + slice[-9876543210:0:3] runtime error: slice bounds out of range [-9876543210::] + slice[-9876543210:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-9876543210:0:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-9876543210:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-9876543210:3:-1] runtime error: slice bounds out of range [::-1] + slice[-9876543210:3:0] runtime error: slice bounds out of range [:3:0] + slice[-9876543210:3:3] runtime error: slice bounds out of range [-9876543210::] + slice[-9876543210:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-9876543210:3:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-9876543210:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-9876543210:4:-1] runtime error: slice bounds out of range [::-1] + slice[-9876543210:4:0] runtime error: slice bounds out of range [:4:0] + slice[-9876543210:4:3] runtime error: slice bounds out of range [:4:3] + slice[-9876543210:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-9876543210:4:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-9876543210:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-9876543210:9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[-9876543210:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + slice[-9876543210:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + slice[-9876543210:9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-9876543210:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-1:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-1:-9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[-1:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + slice[-1:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + slice[-1:-9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-1:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-1:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-1:-1:-1] runtime error: slice bounds out of range [::-1] + slice[-1:-1:0] runtime error: slice bounds out of range [:-1:] + slice[-1:-1:3] runtime error: slice bounds out of range [:-1:] + slice[-1:-1:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-1:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-1:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-1:0:-1] runtime error: slice bounds out of range [::-1] + slice[-1:0:0] runtime error: slice bounds out of range [-1::] + slice[-1:0:3] runtime error: slice bounds out of range [-1::] + slice[-1:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-1:0:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-1:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-1:3:-1] runtime error: slice bounds out of range [::-1] + slice[-1:3:0] runtime error: slice bounds out of range [:3:0] + slice[-1:3:3] runtime error: slice bounds out of range [-1::] + slice[-1:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-1:3:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-1:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-1:4:-1] runtime error: slice bounds out of range [::-1] + slice[-1:4:0] runtime error: slice bounds out of range [:4:0] + slice[-1:4:3] runtime error: slice bounds out of range [:4:3] + slice[-1:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-1:4:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[-1:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[-1:9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[-1:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + slice[-1:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + slice[-1:9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[-1:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[0:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[0:-9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[0:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + slice[0:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + slice[0:-9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[0:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[0:-1:-1] runtime error: slice bounds out of range [::-1] + slice[0:-1:0] runtime error: slice bounds out of range [:-1:] + slice[0:-1:3] runtime error: slice bounds out of range [:-1:] + slice[0:-1:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[0:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[0:0:-1] runtime error: slice bounds out of range [::-1] + slice[0:0:0] no panic + slice[0:0:3] no panic + slice[0:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:0:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[0:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[0:3:-1] runtime error: slice bounds out of range [::-1] + slice[0:3:0] runtime error: slice bounds out of range [:3:0] + slice[0:3:3] no panic + slice[0:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:3:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[0:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[0:4:-1] runtime error: slice bounds out of range [::-1] + slice[0:4:0] runtime error: slice bounds out of range [:4:0] + slice[0:4:3] runtime error: slice bounds out of range [:4:3] + slice[0:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:4:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[0:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[0:9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[0:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + slice[0:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + slice[0:9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[3:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[3:-9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[3:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + slice[3:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + slice[3:-9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[3:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[3:-1:-1] runtime error: slice bounds out of range [::-1] + slice[3:-1:0] runtime error: slice bounds out of range [:-1:] + slice[3:-1:3] runtime error: slice bounds out of range [:-1:] + slice[3:-1:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[3:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[3:0:-1] runtime error: slice bounds out of range [::-1] + slice[3:0:0] runtime error: slice bounds out of range [3:0:] + slice[3:0:3] runtime error: slice bounds out of range [3:0:] + slice[3:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:0:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[3:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[3:3:-1] runtime error: slice bounds out of range [::-1] + slice[3:3:0] runtime error: slice bounds out of range [:3:0] + slice[3:3:3] no panic + slice[3:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:3:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[3:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[3:4:-1] runtime error: slice bounds out of range [::-1] + slice[3:4:0] runtime error: slice bounds out of range [:4:0] + slice[3:4:3] runtime error: slice bounds out of range [:4:3] + slice[3:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:4:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[3:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[3:9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[3:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + slice[3:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + slice[3:9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[4:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[4:-9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[4:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + slice[4:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + slice[4:-9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[4:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[4:-1:-1] runtime error: slice bounds out of range [::-1] + slice[4:-1:0] runtime error: slice bounds out of range [:-1:] + slice[4:-1:3] runtime error: slice bounds out of range [:-1:] + slice[4:-1:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[4:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[4:0:-1] runtime error: slice bounds out of range [::-1] + slice[4:0:0] runtime error: slice bounds out of range [4:0:] + slice[4:0:3] runtime error: slice bounds out of range [4:0:] + slice[4:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:0:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[4:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[4:3:-1] runtime error: slice bounds out of range [::-1] + slice[4:3:0] runtime error: slice bounds out of range [:3:0] + slice[4:3:3] runtime error: slice bounds out of range [4:3:] + slice[4:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:3:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[4:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[4:4:-1] runtime error: slice bounds out of range [::-1] + slice[4:4:0] runtime error: slice bounds out of range [:4:0] + slice[4:4:3] runtime error: slice bounds out of range [:4:3] + slice[4:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:4:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[4:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[4:9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[4:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + slice[4:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + slice[4:9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[9876543210:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[9876543210:-9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[9876543210:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + slice[9876543210:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + slice[9876543210:-9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[9876543210:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[9876543210:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[9876543210:-1:-1] runtime error: slice bounds out of range [::-1] + slice[9876543210:-1:0] runtime error: slice bounds out of range [:-1:] + slice[9876543210:-1:3] runtime error: slice bounds out of range [:-1:] + slice[9876543210:-1:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[9876543210:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[9876543210:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[9876543210:0:-1] runtime error: slice bounds out of range [::-1] + slice[9876543210:0:0] runtime error: slice bounds out of range [9876543210:0:] + slice[9876543210:0:3] runtime error: slice bounds out of range [9876543210:0:] + slice[9876543210:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[9876543210:0:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[9876543210:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[9876543210:3:-1] runtime error: slice bounds out of range [::-1] + slice[9876543210:3:0] runtime error: slice bounds out of range [:3:0] + slice[9876543210:3:3] runtime error: slice bounds out of range [9876543210:3:] + slice[9876543210:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[9876543210:3:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[9876543210:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[9876543210:4:-1] runtime error: slice bounds out of range [::-1] + slice[9876543210:4:0] runtime error: slice bounds out of range [:4:0] + slice[9876543210:4:3] runtime error: slice bounds out of range [:4:3] + slice[9876543210:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[9876543210:4:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + slice[9876543210:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + slice[9876543210:9876543210:-1] runtime error: slice bounds out of range [::-1] + slice[9876543210:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + slice[9876543210:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + slice[9876543210:9876543210:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[9876543210:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with capacity 3 + array[-9876543210:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-9876543210:-9876543210:-1] runtime error: slice bounds out of range [::-1] + array[-9876543210:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + array[-9876543210:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + array[-9876543210:-9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[-9876543210:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-9876543210:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-9876543210:-1:-1] runtime error: slice bounds out of range [::-1] + array[-9876543210:-1:0] runtime error: slice bounds out of range [:-1:] + array[-9876543210:-1:3] runtime error: slice bounds out of range [:-1:] + array[-9876543210:-1:4] runtime error: slice bounds out of range [::4] with length 3 + array[-9876543210:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-9876543210:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-9876543210:0:-1] runtime error: slice bounds out of range [::-1] + array[-9876543210:0:0] runtime error: slice bounds out of range [-9876543210::] + array[-9876543210:0:3] runtime error: slice bounds out of range [-9876543210::] + array[-9876543210:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[-9876543210:0:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-9876543210:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-9876543210:3:-1] runtime error: slice bounds out of range [::-1] + array[-9876543210:3:0] runtime error: slice bounds out of range [:3:0] + array[-9876543210:3:3] runtime error: slice bounds out of range [-9876543210::] + array[-9876543210:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[-9876543210:3:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-9876543210:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-9876543210:4:-1] runtime error: slice bounds out of range [::-1] + array[-9876543210:4:0] runtime error: slice bounds out of range [:4:0] + array[-9876543210:4:3] runtime error: slice bounds out of range [:4:3] + array[-9876543210:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[-9876543210:4:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-9876543210:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-9876543210:9876543210:-1] runtime error: slice bounds out of range [::-1] + array[-9876543210:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + array[-9876543210:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + array[-9876543210:9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[-9876543210:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-1:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-1:-9876543210:-1] runtime error: slice bounds out of range [::-1] + array[-1:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + array[-1:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + array[-1:-9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[-1:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-1:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-1:-1:-1] runtime error: slice bounds out of range [::-1] + array[-1:-1:0] runtime error: slice bounds out of range [:-1:] + array[-1:-1:3] runtime error: slice bounds out of range [:-1:] + array[-1:-1:4] runtime error: slice bounds out of range [::4] with length 3 + array[-1:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-1:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-1:0:-1] runtime error: slice bounds out of range [::-1] + array[-1:0:0] runtime error: slice bounds out of range [-1::] + array[-1:0:3] runtime error: slice bounds out of range [-1::] + array[-1:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[-1:0:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-1:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-1:3:-1] runtime error: slice bounds out of range [::-1] + array[-1:3:0] runtime error: slice bounds out of range [:3:0] + array[-1:3:3] runtime error: slice bounds out of range [-1::] + array[-1:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[-1:3:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-1:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-1:4:-1] runtime error: slice bounds out of range [::-1] + array[-1:4:0] runtime error: slice bounds out of range [:4:0] + array[-1:4:3] runtime error: slice bounds out of range [:4:3] + array[-1:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[-1:4:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[-1:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[-1:9876543210:-1] runtime error: slice bounds out of range [::-1] + array[-1:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + array[-1:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + array[-1:9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[-1:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[0:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[0:-9876543210:-1] runtime error: slice bounds out of range [::-1] + array[0:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + array[0:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + array[0:-9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[0:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[0:-1:-1] runtime error: slice bounds out of range [::-1] + array[0:-1:0] runtime error: slice bounds out of range [:-1:] + array[0:-1:3] runtime error: slice bounds out of range [:-1:] + array[0:-1:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[0:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[0:0:-1] runtime error: slice bounds out of range [::-1] + array[0:0:0] no panic + array[0:0:3] no panic + array[0:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:0:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[0:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[0:3:-1] runtime error: slice bounds out of range [::-1] + array[0:3:0] runtime error: slice bounds out of range [:3:0] + array[0:3:3] no panic + array[0:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:3:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[0:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[0:4:-1] runtime error: slice bounds out of range [::-1] + array[0:4:0] runtime error: slice bounds out of range [:4:0] + array[0:4:3] runtime error: slice bounds out of range [:4:3] + array[0:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:4:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[0:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[0:9876543210:-1] runtime error: slice bounds out of range [::-1] + array[0:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + array[0:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + array[0:9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[3:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[3:-9876543210:-1] runtime error: slice bounds out of range [::-1] + array[3:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + array[3:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + array[3:-9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[3:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[3:-1:-1] runtime error: slice bounds out of range [::-1] + array[3:-1:0] runtime error: slice bounds out of range [:-1:] + array[3:-1:3] runtime error: slice bounds out of range [:-1:] + array[3:-1:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[3:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[3:0:-1] runtime error: slice bounds out of range [::-1] + array[3:0:0] runtime error: slice bounds out of range [3:0:] + array[3:0:3] runtime error: slice bounds out of range [3:0:] + array[3:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:0:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[3:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[3:3:-1] runtime error: slice bounds out of range [::-1] + array[3:3:0] runtime error: slice bounds out of range [:3:0] + array[3:3:3] no panic + array[3:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:3:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[3:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[3:4:-1] runtime error: slice bounds out of range [::-1] + array[3:4:0] runtime error: slice bounds out of range [:4:0] + array[3:4:3] runtime error: slice bounds out of range [:4:3] + array[3:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:4:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[3:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[3:9876543210:-1] runtime error: slice bounds out of range [::-1] + array[3:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + array[3:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + array[3:9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[4:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[4:-9876543210:-1] runtime error: slice bounds out of range [::-1] + array[4:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + array[4:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + array[4:-9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[4:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[4:-1:-1] runtime error: slice bounds out of range [::-1] + array[4:-1:0] runtime error: slice bounds out of range [:-1:] + array[4:-1:3] runtime error: slice bounds out of range [:-1:] + array[4:-1:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[4:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[4:0:-1] runtime error: slice bounds out of range [::-1] + array[4:0:0] runtime error: slice bounds out of range [4:0:] + array[4:0:3] runtime error: slice bounds out of range [4:0:] + array[4:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:0:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[4:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[4:3:-1] runtime error: slice bounds out of range [::-1] + array[4:3:0] runtime error: slice bounds out of range [:3:0] + array[4:3:3] runtime error: slice bounds out of range [4:3:] + array[4:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:3:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[4:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[4:4:-1] runtime error: slice bounds out of range [::-1] + array[4:4:0] runtime error: slice bounds out of range [:4:0] + array[4:4:3] runtime error: slice bounds out of range [:4:3] + array[4:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:4:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[4:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[4:9876543210:-1] runtime error: slice bounds out of range [::-1] + array[4:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + array[4:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + array[4:9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[9876543210:-9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[9876543210:-9876543210:-1] runtime error: slice bounds out of range [::-1] + array[9876543210:-9876543210:0] runtime error: slice bounds out of range [:-9876543210:] + array[9876543210:-9876543210:3] runtime error: slice bounds out of range [:-9876543210:] + array[9876543210:-9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[9876543210:-9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[9876543210:-1:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[9876543210:-1:-1] runtime error: slice bounds out of range [::-1] + array[9876543210:-1:0] runtime error: slice bounds out of range [:-1:] + array[9876543210:-1:3] runtime error: slice bounds out of range [:-1:] + array[9876543210:-1:4] runtime error: slice bounds out of range [::4] with length 3 + array[9876543210:-1:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[9876543210:0:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[9876543210:0:-1] runtime error: slice bounds out of range [::-1] + array[9876543210:0:0] runtime error: slice bounds out of range [9876543210:0:] + array[9876543210:0:3] runtime error: slice bounds out of range [9876543210:0:] + array[9876543210:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[9876543210:0:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[9876543210:3:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[9876543210:3:-1] runtime error: slice bounds out of range [::-1] + array[9876543210:3:0] runtime error: slice bounds out of range [:3:0] + array[9876543210:3:3] runtime error: slice bounds out of range [9876543210:3:] + array[9876543210:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[9876543210:3:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[9876543210:4:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[9876543210:4:-1] runtime error: slice bounds out of range [::-1] + array[9876543210:4:0] runtime error: slice bounds out of range [:4:0] + array[9876543210:4:3] runtime error: slice bounds out of range [:4:3] + array[9876543210:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[9876543210:4:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 + array[9876543210:9876543210:-9876543210] runtime error: slice bounds out of range [::-9876543210] + array[9876543210:9876543210:-1] runtime error: slice bounds out of range [::-1] + array[9876543210:9876543210:0] runtime error: slice bounds out of range [:9876543210:0] + array[9876543210:9876543210:3] runtime error: slice bounds out of range [:9876543210:3] + array[9876543210:9876543210:4] runtime error: slice bounds out of range [::4] with length 3 + array[9876543210:9876543210:9876543210] runtime error: slice bounds out of range [::9876543210] with length 3 diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30116u.go b/gcc/testsuite/go.test/test/fixedbugs/issue30116u.go new file mode 100644 index 00000000000..7c2aea2cd48 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30116u.go @@ -0,0 +1,112 @@ +// run + +// Copyright 2019 The Go 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 the text output for bounds check failures is as expected. + +package main + +import ( + "fmt" + "os" + "runtime" + "text/tabwriter" +) + +// Testing with length 3 slices, arrays, and strings. +// A large (>1<<32) value is included to test 32-bit platforms. +var indexes = []uint64{0, 2, 3, 1<<32 - 1, 1<<64 - 1} +var slices = []uint64{0, 3, 4, 1<<32 - 1, 1<<64 - 1} + +var w *tabwriter.Writer + +func main() { + w = tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.AlignRight) + defer w.Flush() + doIndex() + doSlice() + doSlice3() +} +func doIndex() { + a := []int{1, 2, 3} + for _, i := range indexes { + printPanic(fmt.Sprintf("slice[%d]", i), func() { + _ = a[i] + }) + } + b := [3]int{1, 2, 3} + for _, i := range indexes { + printPanic(fmt.Sprintf("array[%d]", i), func() { + _ = b[i] + }) + } + c := "123" + for _, i := range indexes { + printPanic(fmt.Sprintf("string[%d]", i), func() { + _ = c[i] + }) + } +} + +func doSlice() { + a := []int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + printPanic(fmt.Sprintf("slice[%d:%d]", i, j), func() { + _ = a[i:j] + }) + } + } + b := [3]int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + printPanic(fmt.Sprintf("array[%d:%d]", i, j), func() { + _ = b[i:j] + }) + } + } + c := "123" + for _, i := range slices { + for _, j := range slices { + printPanic(fmt.Sprintf("string[%d:%d]", i, j), func() { + _ = c[i:j] + }) + } + } +} + +func doSlice3() { + a := []int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + for _, k := range slices { + printPanic(fmt.Sprintf("slice[%d:%d:%d]", i, j, k), func() { + _ = a[i:j:k] + }) + } + } + } + b := [3]int{1, 2, 3} + for _, i := range slices { + for _, j := range slices { + for _, k := range slices { + printPanic(fmt.Sprintf("array[%d:%d:%d]", i, j, k), func() { + _ = b[i:j:k] + }) + } + } + } +} + +func printPanic(msg string, f func()) { + defer func() { + res := "no panic" + if e := recover(); e != nil { + res = e.(runtime.Error).Error() + } + fmt.Fprintf(w, "%s\t %s\n", msg, res) + }() + f() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30116u.out b/gcc/testsuite/go.test/test/fixedbugs/issue30116u.out new file mode 100644 index 00000000000..ee19192aaab --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30116u.out @@ -0,0 +1,340 @@ + slice[0] no panic + slice[2] no panic + slice[3] runtime error: index out of range [3] with length 3 + slice[4294967295] runtime error: index out of range [4294967295] with length 3 + slice[18446744073709551615] runtime error: index out of range [18446744073709551615] with length 3 + array[0] no panic + array[2] no panic + array[3] runtime error: index out of range [3] with length 3 + array[4294967295] runtime error: index out of range [4294967295] with length 3 + array[18446744073709551615] runtime error: index out of range [18446744073709551615] with length 3 + string[0] no panic + string[2] no panic + string[3] runtime error: index out of range [3] with length 3 + string[4294967295] runtime error: index out of range [4294967295] with length 3 + string[18446744073709551615] runtime error: index out of range [18446744073709551615] with length 3 + slice[0:0] no panic + slice[0:3] no panic + slice[0:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[0:4294967295] runtime error: slice bounds out of range [:4294967295] with capacity 3 + slice[0:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with capacity 3 + slice[3:0] runtime error: slice bounds out of range [3:0] + slice[3:3] no panic + slice[3:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[3:4294967295] runtime error: slice bounds out of range [:4294967295] with capacity 3 + slice[3:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with capacity 3 + slice[4:0] runtime error: slice bounds out of range [4:0] + slice[4:3] runtime error: slice bounds out of range [4:3] + slice[4:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[4:4294967295] runtime error: slice bounds out of range [:4294967295] with capacity 3 + slice[4:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with capacity 3 + slice[4294967295:0] runtime error: slice bounds out of range [4294967295:0] + slice[4294967295:3] runtime error: slice bounds out of range [4294967295:3] + slice[4294967295:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[4294967295:4294967295] runtime error: slice bounds out of range [:4294967295] with capacity 3 + slice[4294967295:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with capacity 3 + slice[18446744073709551615:0] runtime error: slice bounds out of range [18446744073709551615:0] + slice[18446744073709551615:3] runtime error: slice bounds out of range [18446744073709551615:3] + slice[18446744073709551615:4] runtime error: slice bounds out of range [:4] with capacity 3 + slice[18446744073709551615:4294967295] runtime error: slice bounds out of range [:4294967295] with capacity 3 + slice[18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with capacity 3 + array[0:0] no panic + array[0:3] no panic + array[0:4] runtime error: slice bounds out of range [:4] with length 3 + array[0:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + array[0:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + array[3:0] runtime error: slice bounds out of range [3:0] + array[3:3] no panic + array[3:4] runtime error: slice bounds out of range [:4] with length 3 + array[3:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + array[3:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + array[4:0] runtime error: slice bounds out of range [4:0] + array[4:3] runtime error: slice bounds out of range [4:3] + array[4:4] runtime error: slice bounds out of range [:4] with length 3 + array[4:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + array[4:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + array[4294967295:0] runtime error: slice bounds out of range [4294967295:0] + array[4294967295:3] runtime error: slice bounds out of range [4294967295:3] + array[4294967295:4] runtime error: slice bounds out of range [:4] with length 3 + array[4294967295:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + array[4294967295:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + array[18446744073709551615:0] runtime error: slice bounds out of range [18446744073709551615:0] + array[18446744073709551615:3] runtime error: slice bounds out of range [18446744073709551615:3] + array[18446744073709551615:4] runtime error: slice bounds out of range [:4] with length 3 + array[18446744073709551615:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + array[18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + string[0:0] no panic + string[0:3] no panic + string[0:4] runtime error: slice bounds out of range [:4] with length 3 + string[0:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + string[0:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + string[3:0] runtime error: slice bounds out of range [3:0] + string[3:3] no panic + string[3:4] runtime error: slice bounds out of range [:4] with length 3 + string[3:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + string[3:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + string[4:0] runtime error: slice bounds out of range [4:0] + string[4:3] runtime error: slice bounds out of range [4:3] + string[4:4] runtime error: slice bounds out of range [:4] with length 3 + string[4:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + string[4:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + string[4294967295:0] runtime error: slice bounds out of range [4294967295:0] + string[4294967295:3] runtime error: slice bounds out of range [4294967295:3] + string[4294967295:4] runtime error: slice bounds out of range [:4] with length 3 + string[4294967295:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + string[4294967295:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + string[18446744073709551615:0] runtime error: slice bounds out of range [18446744073709551615:0] + string[18446744073709551615:3] runtime error: slice bounds out of range [18446744073709551615:3] + string[18446744073709551615:4] runtime error: slice bounds out of range [:4] with length 3 + string[18446744073709551615:4294967295] runtime error: slice bounds out of range [:4294967295] with length 3 + string[18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [:18446744073709551615] with length 3 + slice[0:0:0] no panic + slice[0:0:3] no panic + slice[0:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:0:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[0:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[0:3:0] runtime error: slice bounds out of range [:3:0] + slice[0:3:3] no panic + slice[0:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:3:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[0:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[0:4:0] runtime error: slice bounds out of range [:4:0] + slice[0:4:3] runtime error: slice bounds out of range [:4:3] + slice[0:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:4:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[0:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[0:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + slice[0:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + slice[0:4294967295:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[0:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[0:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + slice[0:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + slice[0:18446744073709551615:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[0:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[0:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[3:0:0] runtime error: slice bounds out of range [3:0:] + slice[3:0:3] runtime error: slice bounds out of range [3:0:] + slice[3:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:0:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[3:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[3:3:0] runtime error: slice bounds out of range [:3:0] + slice[3:3:3] no panic + slice[3:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:3:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[3:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[3:4:0] runtime error: slice bounds out of range [:4:0] + slice[3:4:3] runtime error: slice bounds out of range [:4:3] + slice[3:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:4:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[3:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[3:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + slice[3:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + slice[3:4294967295:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[3:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[3:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + slice[3:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + slice[3:18446744073709551615:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[3:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[3:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4:0:0] runtime error: slice bounds out of range [4:0:] + slice[4:0:3] runtime error: slice bounds out of range [4:0:] + slice[4:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:0:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4:3:0] runtime error: slice bounds out of range [:3:0] + slice[4:3:3] runtime error: slice bounds out of range [4:3:] + slice[4:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:3:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4:4:0] runtime error: slice bounds out of range [:4:0] + slice[4:4:3] runtime error: slice bounds out of range [:4:3] + slice[4:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:4:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + slice[4:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + slice[4:4294967295:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + slice[4:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + slice[4:18446744073709551615:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4294967295:0:0] runtime error: slice bounds out of range [4294967295:0:] + slice[4294967295:0:3] runtime error: slice bounds out of range [4294967295:0:] + slice[4294967295:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4294967295:0:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4294967295:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4294967295:3:0] runtime error: slice bounds out of range [:3:0] + slice[4294967295:3:3] runtime error: slice bounds out of range [4294967295:3:] + slice[4294967295:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4294967295:3:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4294967295:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4294967295:4:0] runtime error: slice bounds out of range [:4:0] + slice[4294967295:4:3] runtime error: slice bounds out of range [:4:3] + slice[4294967295:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4294967295:4:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4294967295:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4294967295:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + slice[4294967295:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + slice[4294967295:4294967295:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4294967295:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4294967295:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[4294967295:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + slice[4294967295:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + slice[4294967295:18446744073709551615:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[4294967295:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[4294967295:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[18446744073709551615:0:0] runtime error: slice bounds out of range [18446744073709551615:0:] + slice[18446744073709551615:0:3] runtime error: slice bounds out of range [18446744073709551615:0:] + slice[18446744073709551615:0:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[18446744073709551615:0:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[18446744073709551615:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[18446744073709551615:3:0] runtime error: slice bounds out of range [:3:0] + slice[18446744073709551615:3:3] runtime error: slice bounds out of range [18446744073709551615:3:] + slice[18446744073709551615:3:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[18446744073709551615:3:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[18446744073709551615:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[18446744073709551615:4:0] runtime error: slice bounds out of range [:4:0] + slice[18446744073709551615:4:3] runtime error: slice bounds out of range [:4:3] + slice[18446744073709551615:4:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[18446744073709551615:4:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[18446744073709551615:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[18446744073709551615:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + slice[18446744073709551615:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + slice[18446744073709551615:4294967295:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[18446744073709551615:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[18446744073709551615:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + slice[18446744073709551615:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + slice[18446744073709551615:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + slice[18446744073709551615:18446744073709551615:4] runtime error: slice bounds out of range [::4] with capacity 3 + slice[18446744073709551615:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with capacity 3 + slice[18446744073709551615:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with capacity 3 + array[0:0:0] no panic + array[0:0:3] no panic + array[0:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:0:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[0:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[0:3:0] runtime error: slice bounds out of range [:3:0] + array[0:3:3] no panic + array[0:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:3:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[0:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[0:4:0] runtime error: slice bounds out of range [:4:0] + array[0:4:3] runtime error: slice bounds out of range [:4:3] + array[0:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:4:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[0:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[0:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + array[0:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + array[0:4294967295:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[0:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[0:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + array[0:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + array[0:18446744073709551615:4] runtime error: slice bounds out of range [::4] with length 3 + array[0:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[0:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[3:0:0] runtime error: slice bounds out of range [3:0:] + array[3:0:3] runtime error: slice bounds out of range [3:0:] + array[3:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:0:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[3:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[3:3:0] runtime error: slice bounds out of range [:3:0] + array[3:3:3] no panic + array[3:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:3:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[3:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[3:4:0] runtime error: slice bounds out of range [:4:0] + array[3:4:3] runtime error: slice bounds out of range [:4:3] + array[3:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:4:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[3:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[3:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + array[3:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + array[3:4294967295:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[3:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[3:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + array[3:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + array[3:18446744073709551615:4] runtime error: slice bounds out of range [::4] with length 3 + array[3:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[3:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4:0:0] runtime error: slice bounds out of range [4:0:] + array[4:0:3] runtime error: slice bounds out of range [4:0:] + array[4:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:0:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4:3:0] runtime error: slice bounds out of range [:3:0] + array[4:3:3] runtime error: slice bounds out of range [4:3:] + array[4:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:3:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4:4:0] runtime error: slice bounds out of range [:4:0] + array[4:4:3] runtime error: slice bounds out of range [:4:3] + array[4:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:4:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + array[4:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + array[4:4294967295:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + array[4:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + array[4:18446744073709551615:4] runtime error: slice bounds out of range [::4] with length 3 + array[4:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4294967295:0:0] runtime error: slice bounds out of range [4294967295:0:] + array[4294967295:0:3] runtime error: slice bounds out of range [4294967295:0:] + array[4294967295:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[4294967295:0:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4294967295:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4294967295:3:0] runtime error: slice bounds out of range [:3:0] + array[4294967295:3:3] runtime error: slice bounds out of range [4294967295:3:] + array[4294967295:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[4294967295:3:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4294967295:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4294967295:4:0] runtime error: slice bounds out of range [:4:0] + array[4294967295:4:3] runtime error: slice bounds out of range [:4:3] + array[4294967295:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[4294967295:4:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4294967295:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4294967295:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + array[4294967295:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + array[4294967295:4294967295:4] runtime error: slice bounds out of range [::4] with length 3 + array[4294967295:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4294967295:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[4294967295:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + array[4294967295:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + array[4294967295:18446744073709551615:4] runtime error: slice bounds out of range [::4] with length 3 + array[4294967295:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[4294967295:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[18446744073709551615:0:0] runtime error: slice bounds out of range [18446744073709551615:0:] + array[18446744073709551615:0:3] runtime error: slice bounds out of range [18446744073709551615:0:] + array[18446744073709551615:0:4] runtime error: slice bounds out of range [::4] with length 3 + array[18446744073709551615:0:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[18446744073709551615:0:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[18446744073709551615:3:0] runtime error: slice bounds out of range [:3:0] + array[18446744073709551615:3:3] runtime error: slice bounds out of range [18446744073709551615:3:] + array[18446744073709551615:3:4] runtime error: slice bounds out of range [::4] with length 3 + array[18446744073709551615:3:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[18446744073709551615:3:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[18446744073709551615:4:0] runtime error: slice bounds out of range [:4:0] + array[18446744073709551615:4:3] runtime error: slice bounds out of range [:4:3] + array[18446744073709551615:4:4] runtime error: slice bounds out of range [::4] with length 3 + array[18446744073709551615:4:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[18446744073709551615:4:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[18446744073709551615:4294967295:0] runtime error: slice bounds out of range [:4294967295:0] + array[18446744073709551615:4294967295:3] runtime error: slice bounds out of range [:4294967295:3] + array[18446744073709551615:4294967295:4] runtime error: slice bounds out of range [::4] with length 3 + array[18446744073709551615:4294967295:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[18446744073709551615:4294967295:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 + array[18446744073709551615:18446744073709551615:0] runtime error: slice bounds out of range [:18446744073709551615:0] + array[18446744073709551615:18446744073709551615:3] runtime error: slice bounds out of range [:18446744073709551615:3] + array[18446744073709551615:18446744073709551615:4] runtime error: slice bounds out of range [::4] with length 3 + array[18446744073709551615:18446744073709551615:4294967295] runtime error: slice bounds out of range [::4294967295] with length 3 + array[18446744073709551615:18446744073709551615:18446744073709551615] runtime error: slice bounds out of range [::18446744073709551615] with length 3 diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30659.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue30659.dir/a.go new file mode 100644 index 00000000000..3837e021c48 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30659.dir/a.go @@ -0,0 +1,19 @@ +// Copyright 2019 The Go 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 I interface { + I2 +} +type I2 interface { + M() +} +type S struct{} + +func (*S) M() {} + +func New() I { + return &S{} +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30659.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue30659.dir/b.go new file mode 100644 index 00000000000..272e520582e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30659.dir/b.go @@ -0,0 +1,13 @@ +// Copyright 2019 The Go 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 B(p1 a.I, p2 a.I2) int { + return 42 +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue30659.go b/gcc/testsuite/go.test/test/fixedbugs/issue30659.go new file mode 100644 index 00000000000..973ae1dcef2 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue30659.go @@ -0,0 +1,7 @@ +// compiledir + +// Copyright 2019 The Go 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/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/a.go new file mode 100644 index 00000000000..54ed7713f64 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/a.go @@ -0,0 +1,15 @@ +// Copyright 2019 The Go 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 { x int } + +func F() interface{} { + return [2]T{} +} + +func P() interface{} { + return &[2]T{} +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/b.go new file mode 100644 index 00000000000..932d7b0afa5 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/b.go @@ -0,0 +1,15 @@ +// Copyright 2019 The Go 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{} { + return a.F() +} + +func P() interface{} { + return a.P() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/c.go new file mode 100644 index 00000000000..5f31c7ff028 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/c.go @@ -0,0 +1,17 @@ +// Copyright 2019 The Go 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" + +func F() interface{} { + go func(){}() // make it non-inlineable + return b.F() +} + +func P() interface{} { + go func(){}() // make it non-inlineable + return b.P() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/main.go new file mode 100644 index 00000000000..28bb8cde283 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32901.dir/main.go @@ -0,0 +1,18 @@ +// Copyright 2019 The Go 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 "./c" +import "reflect" + +func main() { + x := c.F() + p := c.P() + t := reflect.PtrTo(reflect.TypeOf(x)) + tp := reflect.TypeOf(p) + if t != tp { + panic("FAIL") + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32901.go b/gcc/testsuite/go.test/test/fixedbugs/issue32901.go new file mode 100644 index 00000000000..004c3da79ee --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32901.go @@ -0,0 +1,9 @@ +// rundir + +// Copyright 2019 The Go 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 32901: type descriptor equality bug in gccgo. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32922.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue32922.dir/a.go new file mode 100644 index 00000000000..b13c4b404d1 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32922.dir/a.go @@ -0,0 +1,18 @@ +// Copyright 2019 The Go 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 A() int { + return p("count") +} + +func p(which string, args ...string) int { + switch which { + case "count", "something": + return 1 + default: + return 2 + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32922.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue32922.dir/b.go new file mode 100644 index 00000000000..fdaf42d3dff --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32922.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go 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 B() int { + return 99 + a.A() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue32922.go b/gcc/testsuite/go.test/test/fixedbugs/issue32922.go new file mode 100644 index 00000000000..005c8e68cb4 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue32922.go @@ -0,0 +1,11 @@ +// compiledir + +// Copyright 2019 The Go 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 directory contains a pair of packages that triggers a compiler +// error in gccgo (problem with the way inlinable call expressions are +// imported). See issue 32922 for details. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/a.go new file mode 100644 index 00000000000..056be88aeac --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/a.go @@ -0,0 +1,9 @@ +// Copyright 2019 The Go 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 G interface { + UsesEmpty(p interface{}) int +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/b.go new file mode 100644 index 00000000000..5694b58282c --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/b.go @@ -0,0 +1,24 @@ +// Copyright 2019 The Go 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 Service uint64 +type ServiceDesc struct { + X int + uc +} + +type uc interface { + f() a.G +} + +var q int + +func RS(svcd *ServiceDesc, server interface{}, qq uint8) *Service { + defer func() { q += int(qq) }() + return nil +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/c.go new file mode 100644 index 00000000000..bfdc0b535fe --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/c.go @@ -0,0 +1,19 @@ +// Copyright 2019 The Go 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 ( + "a" + "b" +) + +type BI interface { + Something(s int64) int64 + Another(pxp a.G) int32 +} + +func BRS(sd *b.ServiceDesc, server BI, xyz int) *b.Service { + return b.RS(sd, server, 7) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/d.go b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/d.go new file mode 100644 index 00000000000..f4fff4ac62a --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33013.dir/d.go @@ -0,0 +1,16 @@ +// Copyright 2019 The Go 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 d + +import ( + "b" + "c" +) + +var GA b.Service + +func C() { + c.BRS(nil, nil, 22) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33013.go b/gcc/testsuite/go.test/test/fixedbugs/issue33013.go new file mode 100644 index 00000000000..e363cf500f3 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33013.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 33013: gccgo compiler error with inlinable function + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33020.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33020.dir/a.go new file mode 100644 index 00000000000..948f4fdf3b2 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33020.dir/a.go @@ -0,0 +1,16 @@ +// Copyright 2019 The Go 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 G1 int +var G2 int +var G3 int +var G4 int +var G5 int +var G6 int +var G7 int +var G8 int +var G9 int +var G10 int diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33020.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33020.dir/b.go new file mode 100644 index 00000000000..354ab3ebfe6 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33020.dir/b.go @@ -0,0 +1,22 @@ +// Copyright 2019 The Go 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 N n + +type n struct{} + +func (r n) M1() int { return a.G1 } +func (r n) M2() int { return a.G2 } +func (r n) M3() int { return a.G3 } +func (r n) M4() int { return a.G4 } +func (r n) M5() int { return a.G5 } +func (r n) M6() int { return a.G6 } +func (r n) M7() int { return a.G7 } +func (r n) M8() int { return a.G8 } +func (r n) M9() int { return a.G9 } +func (r n) M10() int { return a.G10 } diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33020.go b/gcc/testsuite/go.test/test/fixedbugs/issue33020.go new file mode 100644 index 00000000000..ccdf1874537 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33020.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 33020: gccgo undefined behavior with inlinable function + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33062.go b/gcc/testsuite/go.test/test/fixedbugs/issue33062.go new file mode 100644 index 00000000000..5e6a3581a17 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33062.go @@ -0,0 +1,33 @@ +// run + +// Copyright 2019 The Go 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 33062: gccgo generates incorrect type equality +// functions. + +package main + +type simpleStruct struct { + int + string +} + +type complexStruct struct { + int + simpleStruct +} + +func main() { + x := complexStruct{1, simpleStruct{2, "xxx"}} + ix := interface{}(x) + y := complexStruct{1, simpleStruct{2, "yyy"}} + iy := interface{}(y) + if ix != ix { + panic("FAIL") + } + if ix == iy { + panic("FAIL") + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33158.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33158.dir/a.go new file mode 100644 index 00000000000..28714e0c991 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33158.dir/a.go @@ -0,0 +1,25 @@ +// Copyright 2019 The Go 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 GS string + +func M() string { + if s := getname("Fred"); s != "" { + return s + } + if s := getname("Joe"); s != "" { + return s + } + + return string("Alex") +} + +// getname can be any function returning a string, just has to be non-inlinable. + +//go:noinline +func getname(s string) string { + return s + "foo" +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33158.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33158.dir/b.go new file mode 100644 index 00000000000..a16f0da600e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33158.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go 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 B() string { + return a.M() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33158.go b/gcc/testsuite/go.test/test/fixedbugs/issue33158.go new file mode 100644 index 00000000000..1bba8f2f76f --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33158.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 33158: gccgo duplicate def error from importing inlinable function + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/a.go new file mode 100644 index 00000000000..2d96301f9cf --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/a.go @@ -0,0 +1,17 @@ +// Copyright 2019 The Go 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 A interface { + M(i interface{}) interface{} +} + +var a1 A +var a2 A + +func V(p A, k, v interface{}) A { + defer func() { a1, a2 = a2, a1 }() + return a1 +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/b.go new file mode 100644 index 00000000000..2a8f518bef5 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/b.go @@ -0,0 +1,25 @@ +// Copyright 2019 The Go 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 Service uint64 + +var q *Service +var r *Service + +type f struct{} + +var fk f + +func No(s a.A, qq uint8) *Service { + defer func() { q, r = r, q }() + return q +} + +func Yes(s a.A, p *uint64) a.A { + return a.V(s, fk, p) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/c.go b/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/c.go new file mode 100644 index 00000000000..ece48d76031 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33219.dir/c.go @@ -0,0 +1,20 @@ +// Copyright 2019 The Go 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 ( + "a" + "b" +) + +type BI interface { + Another(pxp a.A) int32 +} + +//go:noinline +func BRS(sd a.A, xyz int) *b.Service { + x := b.Yes(sd, nil) + return b.No(x, 1) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33219.go b/gcc/testsuite/go.test/test/fixedbugs/issue33219.go new file mode 100644 index 00000000000..45edc8ba65f --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33219.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 33219: gccgo assert in "implements_interface()" + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33739.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue33739.dir/a.go new file mode 100644 index 00000000000..7eb5b927c49 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33739.dir/a.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go 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 F() func() { + return f +} + +func f() {} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33739.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue33739.dir/b.go new file mode 100644 index 00000000000..caca1ec686e --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33739.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go 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" + +func main() { + a.F()() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue33739.go b/gcc/testsuite/go.test/test/fixedbugs/issue33739.go new file mode 100644 index 00000000000..b7707822869 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue33739.go @@ -0,0 +1,9 @@ +// rundir + +// Copyright 2019 The Go 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 33739: gccgo undefined symbol with cross-package inlining + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34503.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue34503.dir/a.go new file mode 100644 index 00000000000..2c149135ad6 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue34503.dir/a.go @@ -0,0 +1,15 @@ +// Copyright 2019 The Go 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" + +type HookFunc func(x uint64) + +var HookV unsafe.Pointer + +func Hook(x uint64) { + (*(*HookFunc)(HookV))(x) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34503.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue34503.dir/b.go new file mode 100644 index 00000000000..21bdfcc1b50 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue34503.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2019 The Go 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 Bfunc() { + a.Hook(101) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34503.go b/gcc/testsuite/go.test/test/fixedbugs/issue34503.go new file mode 100644 index 00000000000..d843df70628 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue34503.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 34503: gccgo compiler error importing inlinable function + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34577.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue34577.dir/a.go new file mode 100644 index 00000000000..b6af5556b3c --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue34577.dir/a.go @@ -0,0 +1,27 @@ +// Copyright 2019 The Go 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 A struct { + x int +} + +type AI interface { + bar() +} + +type AC int + +func (ab AC) bar() { +} + +const ( + ACC = AC(101) +) + +//go:noinline +func W(a A, k, v interface{}) A { + return A{3} +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34577.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue34577.dir/b.go new file mode 100644 index 00000000000..bbcd1af5179 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue34577.dir/b.go @@ -0,0 +1,23 @@ +// Copyright 2019 The Go 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 B struct { + s string +} + +func (b B) Func(x a.A) a.A { + return a.W(x, k, b) +} + +type ktype int + +const k ktype = 0 + +func Func2() a.AI { + return a.ACC +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue34577.go b/gcc/testsuite/go.test/test/fixedbugs/issue34577.go new file mode 100644 index 00000000000..b4caaebb66c --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue34577.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2019 The Go 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 34577: gccgo compiler error emitting export data + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35739.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue35739.dir/a.go new file mode 100644 index 00000000000..88596a571c0 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue35739.dir/a.go @@ -0,0 +1,16 @@ +// Copyright 2020 The Go 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 myError string + +func (e myError) Error() string { return string(e) } + +const myErrorVal myError = "error" + + +func IsMyError(err error) bool { + return err == error(myErrorVal) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35739.dir/b.go b/gcc/testsuite/go.test/test/fixedbugs/issue35739.dir/b.go new file mode 100644 index 00000000000..8d22aac8d6b --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue35739.dir/b.go @@ -0,0 +1,11 @@ +// Copyright 2020 The Go 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(err error) bool { + return a.IsMyError(err) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue35739.go b/gcc/testsuite/go.test/test/fixedbugs/issue35739.go new file mode 100644 index 00000000000..26f09d8c1bf --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue35739.go @@ -0,0 +1,9 @@ +// compiledir + +// Copyright 2020 The Go 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 35739: gccgo inlining error with constant with method. + +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue38125.go b/gcc/testsuite/go.test/test/fixedbugs/issue38125.go new file mode 100644 index 00000000000..1207aecd39b --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue38125.go @@ -0,0 +1,22 @@ +// compile + +// Copyright 2020 The Go 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 mishandled embedded methods of type aliases. + +package p + +type I int + +func (I) M() {} + +type T = struct { + I +} + +func F() { + _ = T.M + _ = struct { I }.M +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40152.go b/gcc/testsuite/go.test/test/fixedbugs/issue40152.go new file mode 100644 index 00000000000..1cb68e99145 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue40152.go @@ -0,0 +1,21 @@ +// run + +// Copyright 2020 The Go 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 mishandles converting an untyped boolean to an interface type. + +package main + +func t(args ...interface{}) bool { + x := true + return x == args[0] +} + +func main() { + r := t("x" == "x" && "y" == "y") + if !r { + panic(r) + } +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40252.dir/a.go b/gcc/testsuite/go.test/test/fixedbugs/issue40252.dir/a.go new file mode 100644 index 00000000000..5519e9331aa --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue40252.dir/a.go @@ -0,0 +1,14 @@ +// Copyright 2020 The Go 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 I interface { + Func() +} + +func Call() { + f := I.Func + f(nil) +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40252.dir/main.go b/gcc/testsuite/go.test/test/fixedbugs/issue40252.dir/main.go new file mode 100644 index 00000000000..93f5b706242 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue40252.dir/main.go @@ -0,0 +1,16 @@ +// Copyright 2020 The Go 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" + +func main() { + defer func() { + if recover() == nil { + panic("expected nil pointer dereference") + } + }() + a.Call() +} diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue40252.go b/gcc/testsuite/go.test/test/fixedbugs/issue40252.go new file mode 100644 index 00000000000..9be4e665d29 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue40252.go @@ -0,0 +1,8 @@ +// rundir + +// Copyright 2020 The Go 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 got an undefined symbol reference when inlining a method expression. +package ignored diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue42790.go b/gcc/testsuite/go.test/test/fixedbugs/issue42790.go new file mode 100644 index 00000000000..d83a02247a3 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue42790.go @@ -0,0 +1,9 @@ +// compile + +// Copyright 2020 The Go 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 + +const _ = -uint(len(string(1<<32)) - len("\uFFFD")) diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue6977.go b/gcc/testsuite/go.test/test/fixedbugs/issue6977.go new file mode 100644 index 00000000000..ba48cefa955 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue6977.go @@ -0,0 +1,40 @@ +// errorcheck + +// Copyright 2019 The Go 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 + +import "io" + +// Alan's initial report. + +type I interface { f(); String() string } +type J interface { g(); String() string } + +type IJ1 = interface { I; J } +type IJ2 = interface { f(); g(); String() string } + +var _ = (*IJ1)(nil) == (*IJ2)(nil) // static assert that IJ1 and IJ2 are identical types + +// The canonical example. + +type ReadWriteCloser interface { io.ReadCloser; io.WriteCloser } + +// Some more cases. + +type M interface { m() } +type M32 interface { m() int32 } +type M64 interface { m() int64 } + +type U1 interface { m() } +type U2 interface { m(); M } +type U3 interface { M; m() } +type U4 interface { M; M; M } +type U5 interface { U1; U2; U3; U4 } + +type U6 interface { m(); m() } // ERROR "duplicate method" +type U7 interface { M32; m() } // ERROR "duplicate method" +type U8 interface { m(); M32 } // ERROR "duplicate method" +type U9 interface { M32; M64 } // ERROR "duplicate method" diff --git a/gcc/testsuite/go.test/test/fixedbugs/issue8042.go b/gcc/testsuite/go.test/test/fixedbugs/issue8042.go new file mode 100644 index 00000000000..5639f97bb89 --- /dev/null +++ b/gcc/testsuite/go.test/test/fixedbugs/issue8042.go @@ -0,0 +1,66 @@ +// compile + +// 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. + +// Verify that gotos across non-variable declarations +// are accepted. + +package p + +func _() { + goto L1 + const x = 0 +L1: + goto L2 + type T int +L2: +} + +func _() { + { + goto L1 + } + const x = 0 +L1: + { + goto L2 + } + type T int +L2: +} + +func _(d int) { + if d > 0 { + goto L1 + } else { + goto L2 + } + const x = 0 +L1: + switch d { + case 1: + goto L3 + case 2: + default: + goto L4 + } + type T1 int +L2: + const y = 1 +L3: + for d > 0 { + if d < 10 { + goto L4 + } + } + type T2 int +L4: + select { + default: + goto L5 + } + type T3 int +L5: +}