test: don't assign address of array to slice.
R=rsc
CC=golang-dev
https://golang.org/cl/2084042
diff --git a/test/convert3.go b/test/convert3.go
index 5f1f0dd..be68c95 100644
--- a/test/convert3.go
+++ b/test/convert3.go
@@ -13,8 +13,8 @@
var d2 = (chan<- int)(c)
var e *[4]int
-var f1 []int = e
-var f2 = []int(e)
+var f1 []int = e[0:]
+var f2 = []int(e[0:])
var g = []int(nil)
diff --git a/test/fixedbugs/bug045.go b/test/fixedbugs/bug045.go
index d8a712c..94888c4 100644
--- a/test/fixedbugs/bug045.go
+++ b/test/fixedbugs/bug045.go
@@ -13,7 +13,7 @@
func main() {
var ta []*T;
- ta = new([1]*T);
+ ta = new([1]*T)[0:];
ta[0] = nil;
}
/*
diff --git a/test/fixedbugs/bug059.go b/test/fixedbugs/bug059.go
index b190d4f..6a77367 100644
--- a/test/fixedbugs/bug059.go
+++ b/test/fixedbugs/bug059.go
@@ -25,7 +25,7 @@
as := new([2]string);
as[0] = "0";
as[1] = "1";
- m["0"] = as;
+ m["0"] = as[0:];
a := m["0"];
a[0] = "x";
diff --git a/test/fixedbugs/bug146.go b/test/fixedbugs/bug146.go
index bfb7529..16324c7 100644
--- a/test/fixedbugs/bug146.go
+++ b/test/fixedbugs/bug146.go
@@ -9,7 +9,7 @@
func main() {
type Slice []byte;
a := [...]byte{ 0 };
- b := Slice(&a); // This should be OK.
+ b := Slice(a[0:]); // This should be OK.
c := Slice(a); // ERROR "invalid|illegal|cannot"
_, _ = b, c;
}
diff --git a/test/ken/array.go b/test/ken/array.go
index 7785cdf..40209f5 100644
--- a/test/ken/array.go
+++ b/test/ken/array.go
@@ -81,8 +81,8 @@
// call ptr dynamic with ptr fixed from new
func testpdpf1() {
a := new([40]int)
- setpd(a)
- res(sumpd(a), 0, 40)
+ setpd(a[0:])
+ res(sumpd(a[0:]), 0, 40)
b := (*a)[5:30]
res(sumpd(b), 5, 30)
@@ -92,8 +92,8 @@
func testpdpf2() {
var a [80]int
- setpd(&a)
- res(sumpd(&a), 0, 80)
+ setpd(a[0:])
+ res(sumpd(a[0:]), 0, 80)
}
// generate bounds error with ptr dynamic
diff --git a/test/ken/slicearray.go b/test/ken/slicearray.go
index 76ec809..536bbf5 100644
--- a/test/ken/slicearray.go
+++ b/test/ken/slicearray.go
@@ -16,12 +16,12 @@
func main() {
lb = 0
hb = 10
- by = &bx
+ by = bx[0:]
tstb()
lb = 0
hb = 10
- fy = &fx
+ fy = fx[0:]
tstf()
// width 1 (byte)
diff --git a/test/nilptr/arraytoslice.go b/test/nilptr/arraytoslice.go
index 65b2f8a..06c862d 100644
--- a/test/nilptr/arraytoslice.go
+++ b/test/nilptr/arraytoslice.go
@@ -33,5 +33,5 @@
// usual len and cap, we require the *array -> slice
// conversion to do the check.
var p *[1<<30]byte = nil;
- f(p); // should crash
+ f(p[0:]); // should crash
}
diff --git a/test/nilptr/arraytoslice1.go b/test/nilptr/arraytoslice1.go
index b5240a8..286572a 100644
--- a/test/nilptr/arraytoslice1.go
+++ b/test/nilptr/arraytoslice1.go
@@ -29,6 +29,6 @@
// usual len and cap, we require the *array -> slice
// conversion to do the check.
var p *[1<<30]byte = nil;
- var x []byte = p; // should crash
+ var x []byte = p[0:]; // should crash
_ = x;
}
diff --git a/test/nilptr/arraytoslice2.go b/test/nilptr/arraytoslice2.go
index 38e1a5cb..4ac97f1 100644
--- a/test/nilptr/arraytoslice2.go
+++ b/test/nilptr/arraytoslice2.go
@@ -31,5 +31,5 @@
// conversion to do the check.
var x []byte;
var y = &x;
- *y = q; // should crash (uses arraytoslice runtime routine)
+ *y = q[0:]; // should crash (uses arraytoslice runtime routine)
}