aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDan Willemsen <dwillemsen@google.com>2017-02-21 17:11:40 -0800
committerDan Willemsen <dwillemsen@google.com>2017-02-21 17:11:40 -0800
commita727cd0454f0222bf8ac6fd0e124914c2074021d (patch)
tree8dbf92b89c95e1868e89022846ff300708f01e9d /test
parent1d8b74d1ad3854bdaf8ede7e223c3d015ec96628 (diff)
downloadplatform_prebuilts_go_linux-x86-a727cd0454f0222bf8ac6fd0e124914c2074021d.tar.gz
platform_prebuilts_go_linux-x86-a727cd0454f0222bf8ac6fd0e124914c2074021d.tar.bz2
platform_prebuilts_go_linux-x86-a727cd0454f0222bf8ac6fd0e124914c2074021d.zip
Update prebuilts to go1.8 ab/3753832android-o-preview-1android-n-mr2-preview-2o-preview
Test: m -j blueprint_tools Change-Id: I93a8c971d66bc892c6892796791c689eb3bd1836
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue18725.go24
-rw-r--r--test/fixedbugs/issue18808.go63
-rw-r--r--test/fixedbugs/issue18906.go36
-rw-r--r--test/fixedbugs/issue18915.go21
-rw-r--r--test/fixedbugs/issue6036.go2
-rw-r--r--test/nilptr3.go36
-rw-r--r--test/writebarrier.go16
7 files changed, 179 insertions, 19 deletions
diff --git a/test/fixedbugs/issue18725.go b/test/fixedbugs/issue18725.go
new file mode 100644
index 00000000..c632dbad
--- /dev/null
+++ b/test/fixedbugs/issue18725.go
@@ -0,0 +1,24 @@
+// 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.
+
+package main
+
+import "os"
+
+func panicWhenNot(cond bool) {
+ if cond {
+ os.Exit(0)
+ } else {
+ panic("nilcheck elim failed")
+ }
+}
+
+func main() {
+ e := (*string)(nil)
+ panicWhenNot(e == e)
+ // Should never reach this line.
+ panicWhenNot(*e == *e)
+}
diff --git a/test/fixedbugs/issue18808.go b/test/fixedbugs/issue18808.go
new file mode 100644
index 00000000..c98386ee
--- /dev/null
+++ b/test/fixedbugs/issue18808.go
@@ -0,0 +1,63 @@
+// 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.
+
+package main
+
+const lim = 0x80000000
+
+//go:noinline
+func eq(x uint32) {
+ if x == lim {
+ return
+ }
+ panic("x == lim returned false")
+}
+
+//go:noinline
+func neq(x uint32) {
+ if x != lim {
+ panic("x != lim returned true")
+ }
+}
+
+//go:noinline
+func gt(x uint32) {
+ if x > lim {
+ return
+ }
+ panic("x > lim returned false")
+}
+
+//go:noinline
+func gte(x uint32) {
+ if x >= lim {
+ return
+ }
+ panic("x >= lim returned false")
+}
+
+//go:noinline
+func lt(x uint32) {
+ if x < lim {
+ panic("x < lim returned true")
+ }
+}
+
+//go:noinline
+func lte(x uint32) {
+ if x <= lim {
+ panic("x <= lim returned true")
+ }
+}
+
+func main() {
+ eq(lim)
+ neq(lim)
+ gt(lim+1)
+ gte(lim+1)
+ lt(lim+1)
+ lte(lim+1)
+}
diff --git a/test/fixedbugs/issue18906.go b/test/fixedbugs/issue18906.go
new file mode 100644
index 00000000..544400be
--- /dev/null
+++ b/test/fixedbugs/issue18906.go
@@ -0,0 +1,36 @@
+// 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.
+
+package main
+
+//go:noinline
+func f(x int) {
+}
+
+//go:noinline
+func val() int8 {
+ return -1
+}
+
+var (
+ array = [257]int{}
+ slice = array[1:]
+)
+
+func init() {
+ for i := range array {
+ array[i] = i - 1
+ }
+}
+
+func main() {
+ x := val()
+ y := int(uint8(x))
+ f(y) // try and force y to be calculated and spilled
+ if slice[y] != 255 {
+ panic("incorrect value")
+ }
+}
diff --git a/test/fixedbugs/issue18915.go b/test/fixedbugs/issue18915.go
new file mode 100644
index 00000000..a432bbc1
--- /dev/null
+++ b/test/fixedbugs/issue18915.go
@@ -0,0 +1,21 @@
+// 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.
+
+// Make sure error message for invalid conditions
+// or tags are consistent with earlier Go versions.
+
+package p
+
+func _() {
+ if a := 10 { // ERROR "a := 10 used as value"
+ }
+
+ for b := 10 { // ERROR "b := 10 used as value"
+ }
+
+ switch c := 10 { // ERROR "c := 10 used as value"
+ }
+}
diff --git a/test/fixedbugs/issue6036.go b/test/fixedbugs/issue6036.go
index 795b223d..8ebef5a4 100644
--- a/test/fixedbugs/issue6036.go
+++ b/test/fixedbugs/issue6036.go
@@ -1,4 +1,4 @@
-// +build amd64
+// +build !386,!arm,!mips,!mipsle,!amd64p32
// compile
// Copyright 2013 The Go Authors. All rights reserved.
diff --git a/test/nilptr3.go b/test/nilptr3.go
index 8fdae8c0..c681cba5 100644
--- a/test/nilptr3.go
+++ b/test/nilptr3.go
@@ -40,23 +40,23 @@ var (
)
func f1() {
- _ = *intp // ERROR "generated nil check"
+ _ = *intp // ERROR "removed nil check"
// This one should be removed but the block copy needs
// to be turned into its own pseudo-op in order to see
// the indirect.
- _ = *arrayp // ERROR "generated nil check"
+ _ = *arrayp // ERROR "removed nil check"
// 0-byte indirect doesn't suffice.
// we don't registerize globals, so there are no removed.* nil checks.
- _ = *array0p // ERROR "generated nil check"
_ = *array0p // ERROR "removed nil check"
+ _ = *array0p // ERROR "generated nil check"
- _ = *intp // ERROR "removed nil check"
+ _ = *intp // ERROR "generated nil check"
_ = *arrayp // ERROR "removed nil check"
_ = *structp // ERROR "generated nil check"
_ = *emptyp // ERROR "generated nil check"
- _ = *arrayp // ERROR "removed nil check"
+ _ = *arrayp // ERROR "generated nil check"
}
func f2() {
@@ -71,15 +71,15 @@ func f2() {
empty1p *Empty1
)
- _ = *intp // ERROR "generated nil check"
- _ = *arrayp // ERROR "generated nil check"
- _ = *array0p // ERROR "generated nil check"
- _ = *array0p // ERROR "removed.* nil check"
_ = *intp // ERROR "removed.* nil check"
_ = *arrayp // ERROR "removed.* nil check"
+ _ = *array0p // ERROR "removed.* nil check"
+ _ = *array0p // ERROR "generated nil check"
+ _ = *intp // ERROR "generated nil check"
+ _ = *arrayp // ERROR "removed.* nil check"
_ = *structp // ERROR "generated nil check"
_ = *emptyp // ERROR "generated nil check"
- _ = *arrayp // ERROR "removed.* nil check"
+ _ = *arrayp // ERROR "generated nil check"
_ = *bigarrayp // ERROR "generated nil check" ARM removed nil check before indirect!!
_ = *bigstructp // ERROR "generated nil check"
_ = *empty1p // ERROR "generated nil check"
@@ -122,16 +122,16 @@ func f3(x *[10000]int) {
// x wasn't going to change across the function call.
// But it's a little complex to do and in practice doesn't
// matter enough.
- _ = x[9999] // ERROR "removed nil check"
+ _ = x[9999] // ERROR "generated nil check" // TODO: fix
}
func f3a() {
x := fx10k()
y := fx10k()
z := fx10k()
- _ = &x[9] // ERROR "generated nil check"
- y = z
_ = &x[9] // ERROR "removed.* nil check"
+ y = z
+ _ = &x[9] // ERROR "generated nil check"
x = y
_ = &x[9] // ERROR "generated nil check"
}
@@ -139,11 +139,11 @@ func f3a() {
func f3b() {
x := fx10k()
y := fx10k()
- _ = &x[9] // ERROR "generated nil check"
+ _ = &x[9] // ERROR "removed.* nil check"
y = x
_ = &x[9] // ERROR "removed.* nil check"
x = y
- _ = &x[9] // ERROR "removed.* nil check"
+ _ = &x[9] // ERROR "generated nil check"
}
func fx10() *[10]int
@@ -179,15 +179,15 @@ func f4(x *[10]int) {
_ = x[9] // ERROR "generated nil check" // bug would like to remove before indirect
fx10()
- _ = x[9] // ERROR "removed nil check"
+ _ = x[9] // ERROR "generated nil check" // TODO: fix
x = fx10()
y := fx10()
- _ = &x[9] // ERROR "generated nil check"
+ _ = &x[9] // ERROR "removed[a-z ]* nil check"
y = x
_ = &x[9] // ERROR "removed[a-z ]* nil check"
x = y
- _ = &x[9] // ERROR "removed[a-z ]* nil check"
+ _ = &x[9] // ERROR "generated nil check"
}
func f5(p *float32, q *float64, r *float32, s *float64) float64 {
diff --git a/test/writebarrier.go b/test/writebarrier.go
index 6460a6f9..13f7b546 100644
--- a/test/writebarrier.go
+++ b/test/writebarrier.go
@@ -220,3 +220,19 @@ func f22(x *int) (y *int) {
*p = x // no barrier
return
}
+
+type T23 struct {
+ p *int
+ a int
+}
+
+var t23 T23
+var i23 int
+
+func f23() {
+ // zeroing global needs write barrier for the hybrid barrier.
+ t23 = T23{} // ERROR "write barrier"
+ // also test partial assignments
+ t23 = T23{a: 1} // ERROR "write barrier"
+ t23 = T23{p: &i23} // ERROR "write barrier"
+}