summaryrefslogtreecommitdiff
path: root/test/fixedbugs
diff options
context:
space:
mode:
Diffstat (limited to 'test/fixedbugs')
-rw-r--r--test/fixedbugs/bug040.go2
-rw-r--r--test/fixedbugs/bug086.go4
-rw-r--r--test/fixedbugs/bug342.go6
-rw-r--r--test/fixedbugs/bug412.go4
-rw-r--r--test/fixedbugs/bug469.go13
-rw-r--r--test/fixedbugs/bug474.go29
-rw-r--r--test/fixedbugs/issue4663.go1
-rw-r--r--test/fixedbugs/issue4813.go52
-rw-r--r--test/fixedbugs/issue4964.dir/a.go27
-rw-r--r--test/fixedbugs/issue4964.dir/b.go34
-rw-r--r--test/fixedbugs/issue4964.go10
-rw-r--r--test/fixedbugs/issue5002.go16
-rw-r--r--test/fixedbugs/issue5056.go34
-rw-r--r--test/fixedbugs/issue5089.go15
14 files changed, 224 insertions, 23 deletions
diff --git a/test/fixedbugs/bug040.go b/test/fixedbugs/bug040.go
index 007f47f9f..d2cf88afc 100644
--- a/test/fixedbugs/bug040.go
+++ b/test/fixedbugs/bug040.go
@@ -7,5 +7,5 @@
package main
func f (x, // GCCGO_ERROR "previous"
- x int) { // ERROR "redeclared|redefinition" "duplicate"
+ x int) { // ERROR "duplicate argument|redefinition"
}
diff --git a/test/fixedbugs/bug086.go b/test/fixedbugs/bug086.go
index fc69e0e3f..f03982b30 100644
--- a/test/fixedbugs/bug086.go
+++ b/test/fixedbugs/bug086.go
@@ -6,12 +6,12 @@
package main
-func f() int { // ERROR "return|control"
+func f() int { // GCCGO_ERROR "control"
if false {
return 0;
}
// we should not be able to return successfully w/o a return statement
-}
+} // GC_ERROR "return"
func main() {
print(f(), "\n");
diff --git a/test/fixedbugs/bug342.go b/test/fixedbugs/bug342.go
index 5f1efbdfe..ffcb66811 100644
--- a/test/fixedbugs/bug342.go
+++ b/test/fixedbugs/bug342.go
@@ -9,11 +9,7 @@
package p
type a interface {
- foo(x int) (x int) // ERROR "redeclared|redefinition"
-}
-
-var b interface {
- bar(y int) (y int) // ERROR "redeclared|redefinition"
+ foo(x int) (x int) // ERROR "duplicate argument|redefinition"
}
/*
diff --git a/test/fixedbugs/bug412.go b/test/fixedbugs/bug412.go
index 8dd0a5fcc..c7ddc0cac 100644
--- a/test/fixedbugs/bug412.go
+++ b/test/fixedbugs/bug412.go
@@ -7,8 +7,8 @@
package p
type t struct {
- x int // ERROR "duplicate field x|duplicate field name .x."
- x int
+ x int // GCCGO_ERROR "duplicate field name .x."
+ x int // GC_ERROR "duplicate field x"
}
func f(t *t) int {
diff --git a/test/fixedbugs/bug469.go b/test/fixedbugs/bug469.go
deleted file mode 100644
index 71157a4c4..000000000
--- a/test/fixedbugs/bug469.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// compile
-
-// Copyright 2012 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// The gccgo compiler would complain about a redefinition of i, but
-// the spec imposes no requirements on parameter names in a function
-// type.
-
-package p
-
-type F func(i int) (i int)
diff --git a/test/fixedbugs/bug474.go b/test/fixedbugs/bug474.go
new file mode 100644
index 000000000..b8264872a
--- /dev/null
+++ b/test/fixedbugs/bug474.go
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Bug in method values: escape analysis was off.
+
+package main
+
+import "sync"
+
+var called = false
+
+type T struct {
+ once sync.Once
+}
+
+func (t *T) M() {
+ called = true
+}
+
+func main() {
+ var t T
+ t.once.Do(t.M)
+ if !called {
+ panic("not called")
+ }
+}
diff --git a/test/fixedbugs/issue4663.go b/test/fixedbugs/issue4663.go
index b3d660287..edaee93c5 100644
--- a/test/fixedbugs/issue4663.go
+++ b/test/fixedbugs/issue4663.go
@@ -11,4 +11,5 @@ package main
func a(b int) int64 {
b // ERROR "not used"
+ return 0
}
diff --git a/test/fixedbugs/issue4813.go b/test/fixedbugs/issue4813.go
new file mode 100644
index 000000000..0ca9d3f72
--- /dev/null
+++ b/test/fixedbugs/issue4813.go
@@ -0,0 +1,52 @@
+// errorcheck
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 4813: use of constant floats as indices.
+
+package main
+
+var A [3]int
+var S []int
+var T string
+
+const (
+ i = 1
+ f = 2.0
+ f2 = 2.1
+ c = complex(2, 0)
+ c2 = complex(2, 1)
+)
+
+var (
+ vf = f
+ vc = c
+)
+
+var (
+ a1 = A[i]
+ a2 = A[f]
+ a3 = A[f2] // ERROR "truncated"
+ a4 = A[c]
+ a5 = A[c2] // ERROR "truncated"
+ a6 = A[vf] // ERROR "non-integer"
+ a7 = A[vc] // ERROR "non-integer"
+
+ s1 = S[i]
+ s2 = S[f]
+ s3 = S[f2] // ERROR "truncated"
+ s4 = S[c]
+ s5 = S[c2] // ERROR "truncated"
+ s6 = S[vf] // ERROR "non-integer"
+ s7 = S[vc] // ERROR "non-integer"
+
+ t1 = T[i]
+ t2 = T[f]
+ t3 = T[f2] // ERROR "truncated"
+ t4 = T[c]
+ t5 = T[c2] // ERROR "truncated"
+ t6 = T[vf] // ERROR "non-integer"
+ t7 = T[vc] // ERROR "non-integer"
+)
diff --git a/test/fixedbugs/issue4964.dir/a.go b/test/fixedbugs/issue4964.dir/a.go
new file mode 100644
index 000000000..2b9e44e35
--- /dev/null
+++ b/test/fixedbugs/issue4964.dir/a.go
@@ -0,0 +1,27 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+var global, global2 *int
+
+type T struct {
+ Pointer *int
+}
+
+func dontinline() {}
+
+func Store(t *T) {
+ global = t.Pointer
+ dontinline()
+}
+
+func Store2(t *T) {
+ global2 = t.Pointer
+ dontinline()
+}
+
+func Get() *int {
+ return global
+}
diff --git a/test/fixedbugs/issue4964.dir/b.go b/test/fixedbugs/issue4964.dir/b.go
new file mode 100644
index 000000000..42a6f1d76
--- /dev/null
+++ b/test/fixedbugs/issue4964.dir/b.go
@@ -0,0 +1,34 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "./a"
+
+func F() {
+ // store 1 in a.global
+ x, y := 1, 2
+ t := a.T{Pointer: &x}
+ a.Store(&t)
+ _ = y
+}
+
+func G() {
+ // store 4 in a.global2
+ x, y := 3, 4
+ t := a.T{Pointer: &y}
+ a.Store2(&t)
+ _ = x
+}
+
+func main() {
+ F()
+ G()
+ p := a.Get()
+ n := *p
+ if n != 1 {
+ println(n, "!= 1")
+ panic("n != 1")
+ }
+}
diff --git a/test/fixedbugs/issue4964.go b/test/fixedbugs/issue4964.go
new file mode 100644
index 000000000..8291d1bb9
--- /dev/null
+++ b/test/fixedbugs/issue4964.go
@@ -0,0 +1,10 @@
+// rundir
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 4964: exported escape analysis result is not enough
+// for cross package analysis.
+
+package ignored
diff --git a/test/fixedbugs/issue5002.go b/test/fixedbugs/issue5002.go
new file mode 100644
index 000000000..1e74fa1a1
--- /dev/null
+++ b/test/fixedbugs/issue5002.go
@@ -0,0 +1,16 @@
+// build
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Issue 5002: 8g produces invalid CMPL $0, $0.
+// Used to fail at link time.
+
+package main
+
+func main() {
+ var y int64
+ if y%1 == 0 {
+ }
+}
diff --git a/test/fixedbugs/issue5056.go b/test/fixedbugs/issue5056.go
new file mode 100644
index 000000000..a2cde2a50
--- /dev/null
+++ b/test/fixedbugs/issue5056.go
@@ -0,0 +1,34 @@
+// run
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 5056: escape analysis not applied to wrapper functions
+
+package main
+
+type Foo int16
+
+func (f Foo) Esc() *int{
+ x := int(f)
+ return &x
+}
+
+type iface interface {
+ Esc() *int
+}
+
+var bar, foobar *int
+
+func main() {
+ var quux iface
+ var x Foo
+
+ quux = x
+ bar = quux.Esc()
+ foobar = quux.Esc()
+ if bar == foobar {
+ panic("bar == foobar")
+ }
+}
diff --git a/test/fixedbugs/issue5089.go b/test/fixedbugs/issue5089.go
new file mode 100644
index 000000000..14d6bde98
--- /dev/null
+++ b/test/fixedbugs/issue5089.go
@@ -0,0 +1,15 @@
+// errorcheck
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 5089: gc allows methods on non-locals if symbol already exists
+
+package p
+
+import "bufio"
+
+func (b *bufio.Reader) Buffered() int { // ERROR "non-local"
+ return -1
+}