summaryrefslogtreecommitdiff
path: root/test/fixedbugs
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixedbugs')
-rw-r--r--test/fixedbugs/issue9432.go15
-rw-r--r--test/fixedbugs/issue9537.dir/a.go25
-rw-r--r--test/fixedbugs/issue9537.dir/b.go43
-rw-r--r--test/fixedbugs/issue9537.go10
-rw-r--r--test/fixedbugs/issue9604.go29
-rw-r--r--test/fixedbugs/issue9634.go18
6 files changed, 140 insertions, 0 deletions
diff --git a/test/fixedbugs/issue9432.go b/test/fixedbugs/issue9432.go
new file mode 100644
index 000000000..0d0bc960f
--- /dev/null
+++ b/test/fixedbugs/issue9432.go
@@ -0,0 +1,15 @@
+// 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.
+
+// gc used to recurse infinitely when dowidth is applied
+// to a broken recursive type again.
+// See golang.org/issue/9432.
+package p
+
+type foo struct { // GCCGO_ERROR "invalid recursive type"
+ bar foo
+ blah foo
+} // ERROR "invalid recursive type foo"
diff --git a/test/fixedbugs/issue9537.dir/a.go b/test/fixedbugs/issue9537.dir/a.go
new file mode 100644
index 000000000..818c9eb4a
--- /dev/null
+++ b/test/fixedbugs/issue9537.dir/a.go
@@ -0,0 +1,25 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+type X struct {
+ T [32]byte
+}
+
+func (x *X) Get() []byte {
+ t := x.T
+ return t[:]
+}
+
+func (x *X) RetPtr(i int) *int {
+ i++
+ return &i
+}
+
+func (x *X) RetRPtr(i int) (r1 int, r2 *int) {
+ r1 = i + 1
+ r2 = &r1
+ return
+}
diff --git a/test/fixedbugs/issue9537.dir/b.go b/test/fixedbugs/issue9537.dir/b.go
new file mode 100644
index 000000000..52e64c81f
--- /dev/null
+++ b/test/fixedbugs/issue9537.dir/b.go
@@ -0,0 +1,43 @@
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import (
+ "bytes"
+
+ "./a"
+)
+
+type X struct {
+ *a.X
+}
+
+type Intf interface {
+ Get() []byte
+ RetPtr(int) *int
+ RetRPtr(int) (int, *int)
+}
+
+func main() {
+ x := &a.X{T: [32]byte{1, 2, 3, 4}}
+ var ix Intf = X{x}
+ t1 := ix.Get()
+ t2 := x.Get()
+ if !bytes.Equal(t1, t2) {
+ panic(t1)
+ }
+
+ p1 := ix.RetPtr(5)
+ p2 := x.RetPtr(7)
+ if *p1 != 6 || *p2 != 8 {
+ panic(*p1)
+ }
+
+ r1, r2 := ix.RetRPtr(10)
+ r3, r4 := x.RetRPtr(13)
+ if r1 != 11 || *r2 != 11 || r3 != 14 || *r4 != 14 {
+ panic("bad RetRPtr")
+ }
+}
diff --git a/test/fixedbugs/issue9537.go b/test/fixedbugs/issue9537.go
new file mode 100644
index 000000000..ac2d41b12
--- /dev/null
+++ b/test/fixedbugs/issue9537.go
@@ -0,0 +1,10 @@
+// rundir
+
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 9537: Compiler does not run escape analysis on an inlined
+// generated method wrapper.
+
+package ignored
diff --git a/test/fixedbugs/issue9604.go b/test/fixedbugs/issue9604.go
new file mode 100644
index 000000000..cd9e9e49e
--- /dev/null
+++ b/test/fixedbugs/issue9604.go
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+var x uint16 = 0xffff
+var y uint16 = 0xfffe
+var a uint16 = 0x7000
+var b uint16 = 0x9000
+
+func main() {
+ // Make sure we truncate to smaller-width types after evaluating expressions.
+ // This is a problem for arm where there is no 16-bit comparison op.
+ if ^x != 0 {
+ panic("^uint16(0xffff) != 0")
+ }
+ if ^y != 1 {
+ panic("^uint16(0xfffe) != 1")
+ }
+ if -x != 1 {
+ panic("-uint16(0xffff) != 1")
+ }
+ if a+b != 0 {
+ panic("0x7000+0x9000 != 0")
+ }
+}
diff --git a/test/fixedbugs/issue9634.go b/test/fixedbugs/issue9634.go
new file mode 100644
index 000000000..2d5aae4a3
--- /dev/null
+++ b/test/fixedbugs/issue9634.go
@@ -0,0 +1,18 @@
+// errorcheck
+
+// Copyright 2015 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 9634: Structs are incorrectly unpacked when passed as an argument
+// to append.
+
+package main
+
+func main() {
+ s := struct{
+ t []int
+ u int
+ }{}
+ _ = append(s, 0) // ERROR "must be a slice|must be slice"
+}