diff mbox

[gccgo] Testsuite changes for new type rules

Message ID mcraao2g11g.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Aug. 31, 2010, 5:11 p.m. UTC
The new type rules require some changes to the testsuite.  This patch
implements them.  Committed to gccgo branch.

Ian
diff mbox

Patch

Index: gcc/testsuite/go.test/test/convert3.go
===================================================================
--- gcc/testsuite/go.test/test/convert3.go	(revision 162368)
+++ gcc/testsuite/go.test/test/convert3.go	(working copy)
@@ -13,13 +13,14 @@  var d1 chan<- int = c
 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)
 
-type H *[4]int
+type H []int
 type J []int
+
 var h H
-var j1 J = h	// ERROR "compat|illegal|cannot|cannot"
+var j1 J = h // ERROR "compat|illegal|cannot"
 var j2 = J(h)
Index: gcc/testsuite/go.test/test/ken/array.go
===================================================================
--- gcc/testsuite/go.test/test/ken/array.go	(revision 162368)
+++ gcc/testsuite/go.test/test/ken/array.go	(working copy)
@@ -81,8 +81,8 @@  func testpfpf() {
 // 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 testpdpf1() {
 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
Index: gcc/testsuite/go.test/test/ken/slicearray.go
===================================================================
--- gcc/testsuite/go.test/test/ken/slicearray.go	(revision 162368)
+++ gcc/testsuite/go.test/test/ken/slicearray.go	(working copy)
@@ -16,12 +16,12 @@  var t int
 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)
Index: gcc/testsuite/go.test/test/ken/string.go
===================================================================
--- gcc/testsuite/go.test/test/ken/string.go	(revision 162368)
+++ gcc/testsuite/go.test/test/ken/string.go	(working copy)
@@ -88,7 +88,7 @@  func main() {
 	z1[0] = 'a'
 	z1[1] = 'b'
 	z1[2] = 'c'
-	c = string(&z1)
+	c = string(z1[0:])
 	if c != "abc" {
 		print("create byte array ", c)
 		panic("fail")
@@ -99,7 +99,7 @@  func main() {
 	z2[0] = 'a'
 	z2[1] = '\u1234'
 	z2[2] = 'c'
-	c = string(&z2)
+	c = string(z2[0:])
 	if c != "a\u1234c" {
 		print("create int array ", c)
 		panic("fail")
@@ -110,7 +110,7 @@  func main() {
 	z3[0] = 'a'
 	z3[1] = 'b'
 	z3[2] = 'c'
-	c = string(z3)
+	c = string(z3[0:])
 	if c != "abc" {
 		print("create array pointer ", c)
 		panic("fail")
Index: gcc/testsuite/go.test/test/fixedbugs/bug102.go
===================================================================
--- gcc/testsuite/go.test/test/fixedbugs/bug102.go	(revision 162368)
+++ gcc/testsuite/go.test/test/fixedbugs/bug102.go	(working copy)
@@ -7,19 +7,20 @@ 
 package main
 
 func main() {
-	var b [0]byte;
-	s := string(&b);	// out of bounds trap
+	var b [0]byte
+	s := string(b[0:]) // out of bounds trap
 	if s != "" {
 		panic("bad convert")
 	}
-	var b1 = [5]byte{'h', 'e', 'l', 'l', 'o'};
-	if string(&b1) != "hello" {
+	var b1 = [5]byte{'h', 'e', 'l', 'l', 'o'}
+	if string(b1[0:]) != "hello" {
 		panic("bad convert 1")
 	}
-	var b2 = make([]byte, 5);
-	for i := 0; i < 5; i++ { b2[i] = b1[i] }
+	var b2 = make([]byte, 5)
+	for i := 0; i < 5; i++ {
+		b2[i] = b1[i]
+	}
 	if string(b2) != "hello" {
 		panic("bad convert 2")
 	}
 }
-
Index: gcc/testsuite/go.test/test/fixedbugs/bug045.go
===================================================================
--- gcc/testsuite/go.test/test/fixedbugs/bug045.go	(revision 162368)
+++ gcc/testsuite/go.test/test/fixedbugs/bug045.go	(working copy)
@@ -13,7 +13,7 @@  type T struct {
 func main() {
 	var ta []*T;
 
-	ta = new([1]*T);
+	ta = new([1]*T)[0:];
 	ta[0] = nil;
 }
 /*
Index: gcc/testsuite/go.test/test/fixedbugs/bug146.go
===================================================================
--- gcc/testsuite/go.test/test/fixedbugs/bug146.go	(revision 162368)
+++ gcc/testsuite/go.test/test/fixedbugs/bug146.go	(working copy)
@@ -9,7 +9,7 @@  package main
 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;
 }
Index: gcc/testsuite/go.test/test/fixedbugs/bug059.go
===================================================================
--- gcc/testsuite/go.test/test/fixedbugs/bug059.go	(revision 162368)
+++ gcc/testsuite/go.test/test/fixedbugs/bug059.go	(working copy)
@@ -25,7 +25,7 @@  func main() {
 	as := new([2]string);
 	as[0] = "0";
 	as[1] = "1";
-	m["0"] = as;
+	m["0"] = as[0:];
 
 	a := m["0"];
 	a[0] = "x";
Index: gcc/testsuite/go.test/test/nilptr/arraytoslice.go
===================================================================
--- gcc/testsuite/go.test/test/nilptr/arraytoslice.go	(revision 162368)
+++ gcc/testsuite/go.test/test/nilptr/arraytoslice.go	(working copy)
@@ -32,5 +32,5 @@  func main() {
 	// 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
 }
Index: gcc/testsuite/go.test/test/nilptr/arraytoslice1.go
===================================================================
--- gcc/testsuite/go.test/test/nilptr/arraytoslice1.go	(revision 162368)
+++ gcc/testsuite/go.test/test/nilptr/arraytoslice1.go	(working copy)
@@ -28,6 +28,6 @@  func main() {
 	// 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;
 }
Index: gcc/testsuite/go.test/test/nilptr/arraytoslice2.go
===================================================================
--- gcc/testsuite/go.test/test/nilptr/arraytoslice2.go	(revision 162368)
+++ gcc/testsuite/go.test/test/nilptr/arraytoslice2.go	(working copy)
@@ -30,5 +30,5 @@  func main() {
 	// 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)
 }
Index: gcc/testsuite/go.go-torture/execute/array-2.go
===================================================================
--- gcc/testsuite/go.go-torture/execute/array-2.go	(revision 162076)
+++ gcc/testsuite/go.go-torture/execute/array-2.go	(working copy)
@@ -10,7 +10,7 @@  func fn(a []int) int {
 
 func main() {
   var a [2]int;
-  if fn(&a) != 2 {
+  if fn(a[0:]) != 2 {
     panic(0);
   }
   if a[0] != 0 || a[1] != 1 {