aboutsummaryrefslogtreecommitdiff
path: root/test/fixedbugs
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixedbugs')
-rw-r--r--test/fixedbugs/bug429_run.go7
-rw-r--r--test/fixedbugs/issue21576.go7
-rw-r--r--test/fixedbugs/issue24491a.go3
-rw-r--r--test/fixedbugs/issue35739.dir/a.go15
-rw-r--r--test/fixedbugs/issue35739.dir/b.go11
-rw-r--r--test/fixedbugs/issue35739.go9
-rw-r--r--test/fixedbugs/issue41635.go11
-rw-r--r--test/fixedbugs/issue41736.go105
-rw-r--r--test/fixedbugs/issue41780.go39
-rw-r--r--test/fixedbugs/issue41872.go26
-rw-r--r--test/fixedbugs/issue42032.go27
-rw-r--r--test/fixedbugs/issue42058a.go13
-rw-r--r--test/fixedbugs/issue42058b.go13
-rw-r--r--test/fixedbugs/issue42075.go16
-rw-r--r--test/fixedbugs/issue42076.go21
-rw-r--r--test/fixedbugs/issue4348.go4
16 files changed, 315 insertions, 12 deletions
diff --git a/test/fixedbugs/bug429_run.go b/test/fixedbugs/bug429_run.go
index c6a02aae5e..60cc5b62de 100644
--- a/test/fixedbugs/bug429_run.go
+++ b/test/fixedbugs/bug429_run.go
@@ -1,6 +1,11 @@
-// +build !nacl,!js
// run
+// +build !nacl,!js
+// +build !darwin !arm64
+
+// Skip on darwin/arm64 as it requires external linking, which brings in
+// cgo, causing deadlock detection not working.
+
// Copyright 2014 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
diff --git a/test/fixedbugs/issue21576.go b/test/fixedbugs/issue21576.go
index b7a32f07ac..3797a8c9ba 100644
--- a/test/fixedbugs/issue21576.go
+++ b/test/fixedbugs/issue21576.go
@@ -1,6 +1,11 @@
-// +build !nacl,!js
// run
+// +build !nacl,!js
+// +build !darwin !arm64
+
+// Skip on darwin/arm64 as it requires external linking, which brings in
+// cgo, causing deadlock detection not working.
+
// 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.
diff --git a/test/fixedbugs/issue24491a.go b/test/fixedbugs/issue24491a.go
index 3c595798b5..8accf8c0a3 100644
--- a/test/fixedbugs/issue24491a.go
+++ b/test/fixedbugs/issue24491a.go
@@ -34,9 +34,6 @@ func test(s string, p, q uintptr, rest ...uintptr) int {
panic(s + ": q failed")
}
for _, r := range rest {
- // TODO(mdempsky): Remove.
- break
-
if *(*string)(unsafe.Pointer(r)) != "ok" {
panic(s + ": r[i] failed")
}
diff --git a/test/fixedbugs/issue35739.dir/a.go b/test/fixedbugs/issue35739.dir/a.go
new file mode 100644
index 0000000000..b79503e996
--- /dev/null
+++ b/test/fixedbugs/issue35739.dir/a.go
@@ -0,0 +1,15 @@
+// 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/test/fixedbugs/issue35739.dir/b.go b/test/fixedbugs/issue35739.dir/b.go
new file mode 100644
index 0000000000..8d22aac8d6
--- /dev/null
+++ b/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/test/fixedbugs/issue35739.go b/test/fixedbugs/issue35739.go
new file mode 100644
index 0000000000..26f09d8c1b
--- /dev/null
+++ b/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/test/fixedbugs/issue41635.go b/test/fixedbugs/issue41635.go
index b33c1a07e7..35c0034cdd 100644
--- a/test/fixedbugs/issue41635.go
+++ b/test/fixedbugs/issue41635.go
@@ -7,12 +7,11 @@
package p
func f() { // ERROR ""
- b1 := make([]byte, 1<<17) // ERROR "too large for stack" ""
- b2 := make([]byte, 100, 1<<17) // ERROR "too large for stack" ""
-
n, m := 100, 200
- b1 = make([]byte, n) // ERROR "non-constant size" ""
- b2 = make([]byte, 100, m) // ERROR "non-constant size" ""
+ _ = make([]byte, 1<<17) // ERROR "too large for stack" ""
+ _ = make([]byte, 100, 1<<17) // ERROR "too large for stack" ""
+ _ = make([]byte, n, 1<<17) // ERROR "too large for stack" ""
- _, _ = b1, b2
+ _ = make([]byte, n) // ERROR "non-constant size" ""
+ _ = make([]byte, 100, m) // ERROR "non-constant size" ""
}
diff --git a/test/fixedbugs/issue41736.go b/test/fixedbugs/issue41736.go
new file mode 100644
index 0000000000..36f127f4fb
--- /dev/null
+++ b/test/fixedbugs/issue41736.go
@@ -0,0 +1,105 @@
+// 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
+
+type I struct {
+ x int64
+}
+
+type F struct {
+ x float64
+}
+
+type C struct {
+ x *complex128
+}
+
+type D struct {
+ x complex64
+}
+
+type A [1]*complex128
+
+//go:noinline
+func (i I) X() C {
+ cx := complex(0, float64(i.x))
+ return C{&cx}
+}
+
+//go:noinline
+func (f F) X() C {
+ cx := complex(f.x, 0)
+ return C{&cx}
+}
+
+//go:noinline
+func (c C) X() C {
+ cx := complex(imag(*c.x), real(*c.x))
+ return C{&cx}
+}
+
+//go:noinline
+func (d D) X() C {
+ cx := complex(float64(imag(d.x)), -float64(real(d.x)))
+ return C{&cx}
+}
+
+//go:noinline
+func (a A) X() C {
+ cx := complex(-float64(imag(*a[0])), float64(real(*a[0])))
+ return C{&cx}
+}
+
+//go:noinline
+func (i I) id() I {
+ return i
+}
+
+//go:noinline
+func (f F) id() F {
+ return f
+}
+
+//go:noinline
+func (c C) id() C {
+ return c
+}
+
+//go:noinline
+func (d D) id() D {
+ return d
+}
+
+//go:noinline
+func (a A) id() A {
+ return a
+}
+
+type T interface {
+ X() C
+}
+
+func G(x []T) []T {
+ var y []T
+ for _, a := range x {
+ var v T
+ switch u := a.(type) {
+ case I:
+ v = u.id()
+ case F:
+ v = u.id()
+ case C:
+ v = u.id()
+ case D:
+ v = u.id()
+ case A:
+ v = u.id()
+ }
+ y = append(y, v)
+ }
+ return y
+}
diff --git a/test/fixedbugs/issue41780.go b/test/fixedbugs/issue41780.go
new file mode 100644
index 0000000000..632c144a48
--- /dev/null
+++ b/test/fixedbugs/issue41780.go
@@ -0,0 +1,39 @@
+// 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.
+
+// Checks that conversion of CMP(x,-y) -> CMN(x,y) is only applied in correct context.
+
+package main
+
+type decimal struct {
+ d [8]byte // digits, big-endian representation
+ dp int // decimal point
+}
+
+var powtab = []int{1, 3, 6, 9, 13, 16, 19, 23, 26}
+
+//go:noinline
+func foo(d *decimal) int {
+ exp := int(d.d[1])
+ if d.dp < 0 || d.dp == 0 && d.d[0] < '5' {
+ var n int
+ if -d.dp >= len(powtab) {
+ n = 27
+ } else {
+ n = powtab[-d.dp] // incorrect CMP -> CMN substitution causes indexing panic.
+ }
+ exp += n
+ }
+ return exp
+}
+
+func main() {
+ var d decimal
+ d.d[0] = '1'
+ if foo(&d) != 1 {
+ println("FAILURE (though not the one this test was written to catch)")
+ }
+}
diff --git a/test/fixedbugs/issue41872.go b/test/fixedbugs/issue41872.go
new file mode 100644
index 0000000000..837d61ae0a
--- /dev/null
+++ b/test/fixedbugs/issue41872.go
@@ -0,0 +1,26 @@
+// 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.
+
+package main
+
+//go:noinline
+func f8(x int32) bool {
+ return byte(x&0xc0) == 64
+}
+
+//go:noinline
+func f16(x int32) bool {
+ return uint16(x&0x8040) == 64
+}
+
+func main() {
+ if !f8(64) {
+ panic("wanted true, got false")
+ }
+ if !f16(64) {
+ panic("wanted true, got false")
+ }
+}
diff --git a/test/fixedbugs/issue42032.go b/test/fixedbugs/issue42032.go
new file mode 100644
index 0000000000..c456b1db02
--- /dev/null
+++ b/test/fixedbugs/issue42032.go
@@ -0,0 +1,27 @@
+// 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.
+
+package main
+
+//go:notinheap
+type NIH struct {
+}
+
+type T struct {
+ x *NIH
+ p *int
+}
+
+var y NIH
+var z int
+
+func main() {
+ a := []T{{&y, &z}}
+ a = append(a, T{&y, &z})
+ if a[1].x == nil {
+ panic("pointer not written")
+ }
+}
diff --git a/test/fixedbugs/issue42058a.go b/test/fixedbugs/issue42058a.go
new file mode 100644
index 0000000000..67751a1b0c
--- /dev/null
+++ b/test/fixedbugs/issue42058a.go
@@ -0,0 +1,13 @@
+// errorcheck
+
+// 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
+
+var c chan [2 << 16]byte // ERROR "channel element type too large"
+
+type T [1 << 17]byte
+
+var x chan T // ERROR "channel element type too large"
diff --git a/test/fixedbugs/issue42058b.go b/test/fixedbugs/issue42058b.go
new file mode 100644
index 0000000000..03f86ee1b1
--- /dev/null
+++ b/test/fixedbugs/issue42058b.go
@@ -0,0 +1,13 @@
+// errorcheck
+
+// 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
+
+var c chan [2 << 16]byte // ERROR "channel element type too large"
+
+func f() {
+ _ = 42
+}
diff --git a/test/fixedbugs/issue42075.go b/test/fixedbugs/issue42075.go
new file mode 100644
index 0000000000..af85fb281d
--- /dev/null
+++ b/test/fixedbugs/issue42075.go
@@ -0,0 +1,16 @@
+// errorcheck
+
+// 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
+
+import "unsafe"
+
+type T struct { // ERROR "recursive type"
+ x int
+ p unsafe.Pointer
+
+ f T
+}
diff --git a/test/fixedbugs/issue42076.go b/test/fixedbugs/issue42076.go
new file mode 100644
index 0000000000..3e954813c9
--- /dev/null
+++ b/test/fixedbugs/issue42076.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.
+
+package main
+
+import "reflect"
+
+//go:notinheap
+type NIH struct {
+}
+
+var x, y NIH
+
+func main() {
+ if reflect.DeepEqual(&x, &y) != true {
+ panic("should report true")
+ }
+}
diff --git a/test/fixedbugs/issue4348.go b/test/fixedbugs/issue4348.go
index c59b6b8caa..8b1a56c1d5 100644
--- a/test/fixedbugs/issue4348.go
+++ b/test/fixedbugs/issue4348.go
@@ -1,4 +1,4 @@
-// compile
+// skip
// Copyright 2012 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
@@ -7,6 +7,8 @@
// Issue 4348. After switch to 64-bit ints the compiler generates
// illegal instructions when using large array bounds or indexes.
+// Skip. We reject symbols larger that 2GB (Issue #9862).
+
package main
// 1<<32 on a 64-bit machine, 1 otherwise.