diff mbox

Go patch committed: Update testsuite to r60 release

Message ID mcrobyd4hrq.fsf@coign.corp.google.com
State New
Headers show

Commit Message

Ian Lance Taylor Sept. 21, 2011, 11:06 p.m. UTC
This patch updates the Go testsuite to the Go r60 release.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian


2011-09-21  Ian Lance Taylor  <iant@google.com>

	* go.test/go-test.exp (errchk): Add special case for bug332.
	(go-gc-tests): Add special cases for bug347 and bug348.  Recognize
	some more test lines.
diff mbox

Patch

Index: test/gc2.go
===================================================================
--- test/gc2.go	(revision 0)
+++ test/gc2.go	(revision 0)
@@ -0,0 +1,42 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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.
+
+// Check that buffered channels are garbage collected properly.
+// An interesting case because they have finalizers and used to
+// have self loops that kept them from being collected.
+// (Cyclic data with finalizers is never finalized, nor collected.)
+
+package main
+
+import (
+	"fmt"
+	"os"
+	"runtime"
+)
+
+func main() {
+	const N = 10000
+	st := runtime.MemStats
+	for i := 0; i < N; i++ {
+		c := make(chan int, 10)
+		_ = c
+		if i%100 == 0 {
+			for j := 0; j < 4; j++ {
+				runtime.GC()
+				runtime.Gosched()
+				runtime.GC()
+				runtime.Gosched()
+			}
+		}
+	}
+
+	runtime.UpdateMemStats()
+	obj := runtime.MemStats.HeapObjects - st.HeapObjects
+	if obj > N/5 {
+		fmt.Println("too many objects left:", obj)
+		os.Exit(1)
+	}
+}
Index: test/golden.out
===================================================================
--- test/golden.out	(revision 179018)
+++ test/golden.out	(working copy)
@@ -21,6 +21,9 @@  panic: runtime error: hash of unhashable
 printing: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
 42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
 
+=========== ./goprint.go
+42 true false true +1.500000e+000 world 0x0 [0/0]0x0 0x0 0x0 255
+
 =========== ./helloworld.go
 hello, world
 
@@ -157,13 +160,7 @@  panic: interface conversion: interface i
 panic: interface conversion: interface is main.T, not main.T
 
 
-== bugs/
+=========== fixedbugs/bug328.go
+0x0
 
-=========== bugs/bug322.go
-bugs/bug322.dir/main.go:19: implicit assignment of unexported field 'x' of lib.T in method receiver
-bugs/bug322.dir/main.go:22: implicit assignment of unexported field 'x' of lib.T in assignment
-bugs/bug322.dir/main.go:31: implicit assignment of unexported field 'x' of lib.T in method receiver
-BUG: fails incorrectly
-
-=========== bugs/bug324.go
-BUG: errchk: command succeeded unexpectedly
+== bugs/
Index: test/errchk
===================================================================
--- test/errchk	(revision 179018)
+++ test/errchk	(working copy)
@@ -17,6 +17,13 @@ 
 
 use POSIX;
 
+my $exitcode = 1;
+
+if(@ARGV >= 1 && $ARGV[0] eq "-0") {
+	$exitcode = 0;
+	shift;
+}
+
 if(@ARGV < 1) {
 	print STDERR "Usage: errchk COMPILER [OPTS] SOURCEFILES\n";
 	exit 1;
@@ -47,12 +54,18 @@  $out = join('', <CMD>);
 
 close CMD;
 
-if($? == 0) {
+if($exitcode != 0 && $? == 0) {
 	print STDERR "BUG: errchk: command succeeded unexpectedly\n";
 	print STDERR @out;
 	exit 0;
 }
 
+if($exitcode == 0 && $? != 0) {
+	print STDERR "BUG: errchk: command failed unexpectedly\n";
+	print STDERR @out;
+	exit 0;
+}
+
 if(!WIFEXITED($?)) {
 	print STDERR "BUG: errchk: compiler crashed\n";
 	print STDERR @out, "\n";
@@ -75,25 +88,46 @@  sub chk {
 		$line++;
 		next if $src =~ m|////|;  # double comment disables ERROR
 		next unless $src =~ m|// (GC_)?ERROR (.*)|;
-		$regexp = $2;
-		if($regexp !~ /^"([^"]*)"/) {
+		my $all = $2;
+		if($all !~ /^"([^"]*)"/) {
 			print STDERR "$file:$line: malformed regexp\n";
 			next;
 		}
-		$regexp = $1;
-
 		@errmsg = grep { /$file:$line[:[]/ } @out;
 		@out = grep { !/$file:$line[:[]/ } @out;
 		if(@errmsg == 0) {
 			bug();
-			print STDERR "errchk: $file:$line: missing expected error: '$regexp'\n";
+			print STDERR "errchk: $file:$line: missing expected error: '$all'\n";
 			next;
 		}
-		@match = grep { /$regexp/ } @errmsg;
-		if(@match == 0) {
+		foreach my $regexp ($all =~ /"([^"]*)"/g) {
+			# Turn relative line number in message into absolute line number.
+			if($regexp =~ /LINE(([+-])([0-9]+))?/) {
+				my $n = $line;
+				if(defined($1)) {
+					if($2 eq "+") {
+						$n += int($3);
+					} else {
+						$n -= int($3);
+					}
+				}
+				$regexp = "$`$file:$n$'";
+			}
+	
+			@match = grep { /$regexp/ } @errmsg;
+			if(@match == 0) {
+				bug();
+				print STDERR "errchk: $file:$line: error messages do not match '$regexp'\n";
+				next;
+			}
+			@errmsg = grep { !/$regexp/ } @errmsg;
+		}
+		if(@errmsg != 0) {
 			bug();
-			print STDERR "errchk: $file:$line: error message does not match '$regexp'\n";
-			next;
+			print STDERR "errchk: $file:$line: unmatched error messages:\n";
+			foreach my $l (@errmsg) {
+				print STDERR "> $l";
+			}
 		}
 	}
 }
Index: test/mallocrand.go
===================================================================
--- test/mallocrand.go	(revision 179018)
+++ test/mallocrand.go	(working copy)
@@ -21,6 +21,7 @@  var footprint uint64
 var allocated uint64
 
 func bigger() {
+	runtime.UpdateMemStats()
 	if f := runtime.MemStats.Sys; footprint < f {
 		footprint = f
 		if *chatty {
Index: test/func7.go
===================================================================
--- test/func7.go	(revision 0)
+++ test/func7.go	(revision 0)
@@ -0,0 +1,29 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 calledf = false
+
+func f() int {
+	calledf = true
+	return 1
+}
+
+func g() int {
+	if !calledf {
+		println("BUG: func7 - called g before f")
+	}
+	return 0
+}
+
+func main() {
+	// 6g, 8g, 5g all used to evaluate g() before f().
+	if f() < g() {
+		panic("wrong answer")
+	}
+}
+
Index: test/import1.go
===================================================================
--- test/import1.go	(revision 179018)
+++ test/import1.go	(working copy)
@@ -9,9 +9,9 @@ 
 package main
 
 import "bufio"	// GCCGO_ERROR "previous|not used"
-import bufio "os"	// ERROR "redeclared|redefinition|incompatible"
+import bufio "os"	// ERROR "redeclared|redefinition|incompatible" "imported and not used"
 
 import (
 	"fmt"	// GCCGO_ERROR "previous|not used"
-	fmt "math"	// ERROR "redeclared|redefinition|incompatible"
+	fmt "math"	// ERROR "redeclared|redefinition|incompatible" "imported and not used"
 )
Index: test/sizeof.go
===================================================================
--- test/sizeof.go	(revision 0)
+++ test/sizeof.go	(revision 0)
@@ -0,0 +1,23 @@ 
+// $G $D/$F.go
+
+// Copyright 2011 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 "unsafe"
+
+type T struct {
+	X int
+}
+
+var t T
+
+func isUintptr(uintptr) {}
+
+func main() {
+	isUintptr(unsafe.Sizeof(t))
+	isUintptr(unsafe.Alignof(t))
+	isUintptr(unsafe.Offsetof(t.X))
+}
Index: test/rename1.go
===================================================================
--- test/rename1.go	(revision 179018)
+++ test/rename1.go	(working copy)
@@ -10,7 +10,7 @@  func main() {
 	var n byte       // ERROR "not a type|expected type"
 	var y = float(0) // ERROR "cannot call|expected function"
 	const (
-		a = 1 + iota // ERROR "string|incompatible types"
+		a = 1 + iota // ERROR "string|incompatible types" "convert iota"
 	)
 
 }
Index: test/method2.go
===================================================================
--- test/method2.go	(revision 179018)
+++ test/method2.go	(working copy)
@@ -12,8 +12,14 @@  type T struct {
 type P *T
 type P1 *T
 
-func (p P) val() int   { return 1 } // ERROR "receiver"
-func (p *P1) val() int { return 1 } // ERROR "receiver"
+func (p P) val() int   { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
+func (p *P1) val() int { return 1 } // ERROR "receiver.* pointer|invalid pointer or interface receiver"
+
+type I interface{}
+type I1 interface{}
+
+func (p I) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
+func (p *I1) val() int { return 1 } // ERROR "receiver.*interface|invalid pointer or interface receiver"
 
 type Val interface {
 	val() int
Index: test/goto.go
===================================================================
--- test/goto.go	(revision 0)
+++ test/goto.go	(revision 0)
@@ -0,0 +1,535 @@ 
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 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.
+
+// Each test is in a separate function just so that if the
+// compiler stops processing after one error, we don't
+// lose other ones.
+
+package main
+
+var (
+	i, n int
+	x    []int
+	c    chan int
+	m    map[int]int
+	s    string
+)
+
+// goto after declaration okay
+func _() {
+	x := 1
+	goto L
+L:
+	_ = x
+}
+
+// goto before declaration okay
+func _() {
+	goto L
+L:
+	x := 1
+	_ = x
+}
+
+// goto across declaration not okay
+func _() {
+	goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
+	x := 1	// GCCGO_ERROR "defined here"
+	_ = x
+L:
+}
+
+// goto across declaration in inner scope okay
+func _() {
+	goto L
+	{
+		x := 1
+		_ = x
+	}
+L:
+}
+
+// goto across declaration after inner scope not okay
+func _() {
+	goto L // ERROR "goto L jumps over declaration of x at LINE+5|goto jumps over declaration"
+	{
+		x := 1
+		_ = x
+	}
+	x := 1	// GCCGO_ERROR "defined here"
+	_ = x
+L:
+}
+
+// goto across declaration in reverse okay
+func _() {
+L:
+	x := 1
+	_ = x
+	goto L
+}
+
+// error shows first offending variable
+func _() {
+	goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
+	x := 1	// GCCGO_ERROR "defined here"
+	_ = x
+	y := 1
+	_ = y
+L:
+}
+
+// goto not okay even if code path is dead
+func _() {
+	goto L // ERROR "goto L jumps over declaration of x at LINE+1|goto jumps over declaration"
+	x := 1	// GCCGO_ERROR "defined here"
+	_ = x
+	y := 1
+	_ = y
+	return
+L:
+}
+
+// goto into outer block okay
+func _() {
+	{
+		goto L
+	}
+L:
+}
+
+// goto backward into outer block okay
+func _() {
+L:
+	{
+		goto L
+	}
+}
+
+// goto into inner block not okay
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	{	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+// goto backward into inner block still not okay
+func _() {
+	{	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+// error shows first (outermost) offending block
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	{
+		{
+			{	// GCCGO_ERROR "block starts here"
+			L:
+			}
+		}
+	}
+}
+
+// error prefers block diagnostic over declaration diagnostic
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block"
+	x := 1
+	_ = x
+	{	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+// many kinds of blocks, all invalid to jump into or among,
+// but valid to jump out of
+
+// if
+
+func _() {
+L:
+	if true {
+		goto L
+	}
+}
+
+func _() {
+L:
+	if true {
+		goto L
+	} else {
+	}
+}
+
+func _() {
+L:
+	if false {
+	} else {
+		goto L
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	if true {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	if true {	// GCCGO_ERROR "block starts here"
+	L:
+	} else {
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	if true {
+	} else {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+func _() {
+	if false {	// GCCGO_ERROR "block starts here"
+	L:
+	} else {
+		goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+	}
+}
+
+func _() {
+	if true {
+		goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	} else {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+func _() {
+	if true {
+		goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	} else if false {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+func _() {
+	if true {
+		goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	} else if false {	// GCCGO_ERROR "block starts here"
+	L:
+	} else {
+	}
+}
+
+func _() {
+	// This one is tricky.  There is an implicit scope
+	// starting at the second if statement, and it contains
+	// the final else, so the outermost offending scope
+	// really is LINE+1 (like in the previous test),
+	// even though it looks like it might be LINE+3 instead.
+	if true {
+		goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	} else if false {
+	} else {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+}
+
+/* Want to enable these tests but gofmt mangles them.  Issue 1972.
+
+func _() {
+	// This one is okay, because the else is in the
+	// implicit whole-if block and has no inner block
+	// (no { }) around it.
+	if true {
+		goto L
+	} else
+		L:
+}
+
+func _() {
+	// Still not okay.
+	if true {	//// GCCGO_ERROR "block starts here"
+	L:
+	} else
+		goto L //// ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+*/
+
+// for
+
+func _() {
+	for {
+		goto L
+	}
+L:
+}
+
+func _() {
+	for {
+		goto L
+	L:
+	}
+}
+
+func _() {
+	for {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+	for {	// GCCGO_ERROR "block starts here"
+		goto L
+	L1:
+	}
+L:
+	goto L1 // ERROR "goto L1 jumps into block starting at LINE-5|goto jumps into block"
+}
+
+func _() {
+	for i < n {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+	for i = 0; i < n; i++ {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+	for i = range x {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+	for i = range c {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+	for i = range m {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+func _() {
+	for i = range s {	// GCCGO_ERROR "block starts here"
+	L:
+	}
+	goto L // ERROR "goto L jumps into block starting at LINE-3|goto jumps into block"
+}
+
+// switch
+
+func _() {
+L:
+	switch i {
+	case 0:
+		goto L
+	}
+}
+
+func _() {
+L:
+	switch i {
+	case 0:
+
+	default:
+		goto L
+	}
+}
+
+func _() {
+	switch i {
+	case 0:
+
+	default:
+	L:
+		goto L
+	}
+}
+
+func _() {
+	switch i {
+	case 0:
+
+	default:
+		goto L
+	L:
+	}
+}
+
+func _() {
+	switch i {
+	case 0:
+		goto L
+	L:
+		;
+	default:
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	switch i {
+	case 0:
+	L:	// GCCGO_ERROR "block starts here"
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	switch i {
+	case 0:
+	L:	// GCCGO_ERROR "block starts here"
+		;
+	default:
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	switch i {
+	case 0:
+	default:
+	L:	// GCCGO_ERROR "block starts here"
+	}
+}
+
+func _() {
+	switch i {
+	default:
+		goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	case 0:
+	L:	// GCCGO_ERROR "block starts here"
+	}
+}
+
+func _() {
+	switch i {
+	case 0:
+	L:	// GCCGO_ERROR "block starts here"
+		;
+	default:
+		goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
+	}
+}
+
+// select
+// different from switch.  the statement has no implicit block around it.
+
+func _() {
+L:
+	select {
+	case <-c:
+		goto L
+	}
+}
+
+func _() {
+L:
+	select {
+	case c <- 1:
+
+	default:
+		goto L
+	}
+}
+
+func _() {
+	select {
+	case <-c:
+
+	default:
+	L:
+		goto L
+	}
+}
+
+func _() {
+	select {
+	case c <- 1:
+
+	default:
+		goto L
+	L:
+	}
+}
+
+func _() {
+	select {
+	case <-c:
+		goto L
+	L:
+		;
+	default:
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block"
+	select {
+	case c <- 1:
+	L:	// GCCGO_ERROR "block starts here"
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+2|goto jumps into block"
+	select {
+	case c <- 1:
+	L:	// GCCGO_ERROR "block starts here"
+		;
+	default:
+	}
+}
+
+func _() {
+	goto L // ERROR "goto L jumps into block starting at LINE+3|goto jumps into block"
+	select {
+	case <-c:
+	default:
+	L:	// GCCGO_ERROR "block starts here"
+	}
+}
+
+func _() {
+	select {
+	default:
+		goto L // ERROR "goto L jumps into block starting at LINE+1|goto jumps into block"
+	case <-c:
+	L:	// GCCGO_ERROR "block starts here"
+	}
+}
+
+func _() {
+	select {
+	case <-c:
+	L:	// GCCGO_ERROR "block starts here"
+		;
+	default:
+		goto L // ERROR "goto L jumps into block starting at LINE-4|goto jumps into block"
+	}
+}
Index: test/nil.go
===================================================================
--- test/nil.go	(revision 179018)
+++ test/nil.go	(working copy)
@@ -6,6 +6,11 @@ 
 
 package main
 
+import (
+	"fmt"
+	"time"
+)
+
 type T struct {
 	i int
 }
@@ -33,4 +38,141 @@  func main() {
 	ta[0] = nil
 
 	_, _, _, _, _, _, _, _ = i, f, s, m, c, t, in, ta
+
+	arraytest()
+	chantest()
+	maptest()
+	slicetest()
+}
+
+func shouldPanic(f func()) {
+	defer func() {
+		if recover() == nil {
+			panic("not panicking")
+		}
+	}()
+	f()
+}
+
+func shouldBlock(f func()) {
+	go func() {
+		f()
+		panic("did not block")
+	}()
+	time.Sleep(1e7)
+}
+
+// nil array pointer
+
+func arraytest() {
+	var p *[10]int
+
+	// Looping over indices is fine.
+	s := 0
+	for i := range p {
+		s += i
+	}
+	if s != 45 {
+		panic(s)
+	}
+
+	s = 0
+	for i := 0; i < len(p); i++ {
+		s += i
+	}
+	if s != 45 {
+		panic(s)
+	}
+
+	// Looping over values is not.
+	shouldPanic(func() {
+		for i, v := range p {
+			s += i + v
+		}
+	})
+
+	shouldPanic(func() {
+		for i := 0; i < len(p); i++ {
+			s += p[i]
+		}
+	})
+}
+
+// nil channel
+// select tests already handle select on nil channel
+
+func chantest() {
+	var ch chan int
+
+	// nil channel is never ready
+	shouldBlock(func() {
+		ch <- 1
+	})
+	shouldBlock(func() {
+		<-ch
+	})
+	shouldBlock(func() {
+		x, ok := <-ch
+		println(x, ok)
+	})
+
+	if len(ch) != 0 {
+		panic(len(ch))
+	}
+	if cap(ch) != 0 {
+		panic(cap(ch))
+	}
+}
+
+// nil map
+
+func maptest() {
+	var m map[int]int
+
+	// nil map appears empty
+	if len(m) != 0 {
+		panic(len(m))
+	}
+	if m[1] != 0 {
+		panic(m[1])
+	}
+	if x, ok := m[1]; x != 0 || ok {
+		panic(fmt.Sprint(x, ok))
+	}
+
+	for k, v := range m {
+		panic(k)
+		panic(v)
+	}
+
+	// but cannot be written to
+	shouldPanic(func() {
+		m[2] = 3
+	})
+	shouldPanic(func() {
+		m[2] = 0, false
+	})
+}
+
+// nil slice
+
+func slicetest() {
+	var x []int
+
+	// nil slice is just a 0-element slice.
+	if len(x) != 0 {
+		panic(len(x))
+	}
+	if cap(x) != 0 {
+		panic(cap(x))
+	}
+
+	// no 0-element slices can be read from or written to
+	var s int
+	shouldPanic(func() {
+		s += x[1]
+	})
+	shouldPanic(func() {
+		x[2] = s
+	})
 }
Index: test/malloc1.go
===================================================================
--- test/malloc1.go	(revision 179018)
+++ test/malloc1.go	(working copy)
@@ -18,6 +18,7 @@  var chatty = flag.Bool("v", false, "chat
 
 func main() {
 	runtime.Free(runtime.Alloc(1))
+	runtime.UpdateMemStats()
 	if *chatty {
 		fmt.Printf("%+v %v\n", runtime.MemStats, uint64(0))
 	}
Index: test/run
===================================================================
--- test/run	(revision 179018)
+++ test/run	(working copy)
@@ -5,6 +5,8 @@ 
 
 eval $(gomake --no-print-directory -f ../src/Make.inc go-env)
 
+export E=
+
 case X"$GOARCH" in
 Xamd64)
 	export A=6
@@ -21,11 +23,6 @@  Xarm)
 	exit 1
 esac
 
-case X"$GOOS" in
-Xnacl)
-	export E=${GORUN:-$GOROOT/misc/nacl/naclrun}
-esac
-
 export G=${A}g
 export L=${A}l
 export GOTRACEBACK=0
@@ -36,9 +33,9 @@  failed=0
 
 PATH=/bin:/usr/bin:/usr/local/bin:${GOBIN:-$GOROOT/bin}:`pwd`
 
-RUNFILE=/tmp/gorun-$$-$USER
-TMP1FILE=/tmp/gotest1-$$-$USER
-TMP2FILE=/tmp/gotest2-$$-$USER
+RUNFILE="/tmp/gorun-$$-$USER"
+TMP1FILE="/tmp/gotest1-$$-$USER"
+TMP2FILE="/tmp/gotest2-$$-$USER"
 
 # don't run the machine out of memory: limit individual processes to 4GB.
 # on thresher, 3GB suffices to run the tests; with 2GB, peano fails.
@@ -67,20 +64,20 @@  do
 		fi
 		export F=$(basename $i .go)
 		export D=$dir
-		sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >$RUNFILE
-		if ! { time -p bash -c "bash $RUNFILE >$TMP1FILE 2>&1" ; } 2>$TMP2FILE
+		sed '/^\/\//!q' $i | sed 's@//@@; $d' |sed 's|./\$A.out|$E &|g' >"$RUNFILE"
+		if ! { time -p bash -c "bash '$RUNFILE' >'$TMP1FILE' 2>&1" ; } 2>"$TMP2FILE"
 		then
 			echo
 			echo "===========" $i
-			cat $TMP1FILE
+			cat "$TMP1FILE"
 			echo >&2 fail: $i
 			echo "# $i	# fail" >>pass.out
-		elif test -s $TMP1FILE
+		elif test -s "$TMP1FILE"
 		then
 			echo
 			echo "===========" $i
-			cat $TMP1FILE
-			if grep -q '^BUG' $TMP1FILE
+			cat "$TMP1FILE"
+			if grep -q '^BUG' "$TMP1FILE"
 			then
 				if [ $dir != bugs ]
 				then
@@ -96,12 +93,13 @@  do
 		else
 			echo $i >>pass.out
 		fi
-		echo $(awk 'NR==1{print $2}' $TMP2FILE) $D/$F >>times.out
+		echo $(awk 'NR==1{print $2}' "$TMP2FILE") $D/$F >>times.out
+		rm -f $F.$A $A.out
 	) done
 done | # clean up some stack noise
 	egrep -v '^(r[0-9a-z]+|[cfg]s)  +0x'  |
 	sed '/tmp.*Bus error/s/.*Bus/Bus/; /tmp.*Trace.BPT/s/.*Trace/Trace/
-		s!'$RUNFILE'!$RUNFILE!g
+		s!'"$RUNFILE"'!$RUNFILE!g
 		s/^PC=0x[0-9a-f]*/pc: xxx/
 		s/^pc: 0x[0-9a-f]*/pc: xxx/
 		s/PC=0x[0-9a-f]*/PC=xxx/
@@ -109,11 +107,10 @@  done | # clean up some stack noise
 		/^Trace\/BPT trap/d
 		/RUNFILE/ s/line 1: *[0-9]*/line 1: PID/
 		/^\$RUNFILE: line 1: PID Trace\/breakpoint trap/d
-		/Fault in NaCl untrusted code/d
 		/Segmentation fault/d
 		/^qemu: uncaught target signal 11 (Segmentation fault) - exiting/d' > run.out
 
-rm -f $RUNFILE $TMP1FILE $TMP2FILE *.$A *.a $A.out
+rm -f "$RUNFILE" "$TMP1FILE" "$TMP2FILE" *.$A *.a $A.out
 diffmsg=""
 if ! diff $golden run.out
 then
Index: test/declbad.go
===================================================================
--- test/declbad.go	(revision 179018)
+++ test/declbad.go	(working copy)
@@ -40,7 +40,7 @@  func main() {
 	{
 		// single redeclaration
 		i, f, s := f3()
-		i := f1() // ERROR "redeclared|no new|incompatible"
+		i := 1 // ERROR "redeclared|no new|incompatible"
 		_, _, _ = i, f, s
 	}
 	// double redeclaration
Index: test/bugs/bug322.dir/main.go
===================================================================
--- test/bugs/bug322.dir/main.go	(revision 179018)
+++ test/bugs/bug322.dir/main.go	(working copy)
@@ -1,47 +0,0 @@ 
-// Copyright 2011 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 "./lib"
-
-type I interface {
-	M()
-}
-
-type PI interface {
-	PM()
-}
-
-func main() {
-	var t lib.T
-	t.M()
-	t.PM()
-
-	// This is still an error.
-	// var i1 I = t
-	// i1.M()
-	
-	// This combination is illegal because
-	// PM requires a pointer receiver.
-	// var pi1 PI = t
-	// pi1.PM()
-
-	var pt = &t
-	pt.M()
-	pt.PM()
-
-	var i2 I = pt
-	i2.M()
-
-	var pi2 PI = pt
-	pi2.PM()
-}
-
-/*
-These should not be errors anymore:
-
-bug322.dir/main.go:19: implicit assignment of unexported field 'x' of lib.T in method receiver
-bug322.dir/main.go:32: implicit assignment of unexported field 'x' of lib.T in method receiver
-*/
Index: test/bugs/bug322.dir/lib.go
===================================================================
--- test/bugs/bug322.dir/lib.go	(revision 179018)
+++ test/bugs/bug322.dir/lib.go	(working copy)
@@ -1,15 +0,0 @@ 
-// Copyright 2011 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 lib
-
-type T struct {
-	x int  // non-exported field
-}
-
-func (t T) M() {
-}
-
-func (t *T) PM() {
-}
Index: test/bugs/bug324.dir/p.go
===================================================================
--- test/bugs/bug324.dir/p.go	(revision 179018)
+++ test/bugs/bug324.dir/p.go	(working copy)
@@ -1,15 +0,0 @@ 
-// Copyright 2011 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 p
-
-type Exported interface {
-	private()
-}
-
-type Implementation struct{}
-
-func (p *Implementation) private() { println("p.Implementation.private()") }
-
-var X = new(Implementation)
Index: test/bugs/bug324.dir/main.go
===================================================================
--- test/bugs/bug324.dir/main.go	(revision 179018)
+++ test/bugs/bug324.dir/main.go	(working copy)
@@ -1,48 +0,0 @@ 
-// Copyright 2011 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 (
-	"./p"
-)
-
-type Exported interface {
-	private()
-}
-
-type Implementation struct{}
-
-func (p *Implementation) private() { println("main.Implementation.private()") }
-
-
-func main() {
-	// nothing unusual here
-	var x Exported
-	x = new(Implementation)
-	x.private()  //  main.Implementation.private()
-
-	// same here - should be and is legal
-	var px p.Exported
-	px = p.X
-	
-	// this assignment is correctly illegal:
-	//	px.private undefined (cannot refer to unexported field or method private)
-	// px.private()
-
-	// this assignment is correctly illegal:
-	//	*Implementation does not implement p.Exported (missing p.private method)
-	// px = new(Implementation)
-
-	// this assignment is correctly illegal:
-	//	p.Exported does not implement Exported (missing private method)
-	// x = px
-
-	// this assignment unexpectedly compiles and then executes
-	x = px.(Exported)
-
-	// this is a legitimate call, but because of the previous assignment,
-	// it invokes the method private in p!
-	x.private()  // p.Implementation.private()
-}
Index: test/bugs/bug322.go
===================================================================
--- test/bugs/bug322.go	(revision 179018)
+++ test/bugs/bug322.go	(working copy)
@@ -1,8 +0,0 @@ 
-// $G $D/$F.dir/lib.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: fails incorrectly
-
-// Copyright 2011 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.
-
-// Test case for issue 1402.
-ignored
Index: test/bugs/bug324.go
===================================================================
--- test/bugs/bug324.go	(revision 179018)
+++ test/bugs/bug324.go	(working copy)
@@ -1,8 +0,0 @@ 
-// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ! ./$A.out || echo BUG: should fail
-
-// Copyright 2011 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.
-
-// Test case for issue 1550
-ignored
Index: test/shift1.go
===================================================================
--- test/shift1.go	(revision 0)
+++ test/shift1.go	(revision 0)
@@ -0,0 +1,36 @@ 
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 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 1708, illegal cases.
+
+package p
+
+func f(x int) int         { return 0 }
+func g(x interface{}) int { return 0 }
+func h(x float64) int     { return 0 }
+
+// from the spec
+var (
+	s uint    = 33
+	u         = 1.0 << s // ERROR "invalid operation|shift of non-integer operand"
+	v float32 = 1 << s   // ERROR "invalid" "as type float32"
+)
+
+// non-constant shift expressions
+var (
+	e1       = g(2.0 << s) // ERROR "invalid" "as type interface"
+	f1       = h(2 << s)   // ERROR "invalid" "as type float64"
+	g1 int64 = 1.1 << s    // ERROR "truncated"
+)
+
+// constant shift expressions
+const c uint = 65
+
+var (
+	a2 int = 1.0 << c    // ERROR "overflow"
+	b2     = 1.0 << c    // ERROR "overflow"
+	d2     = f(1.0 << c) // ERROR "overflow"
+)
Index: test/initializerr.go
===================================================================
--- test/initializerr.go	(revision 179018)
+++ test/initializerr.go	(working copy)
@@ -17,7 +17,7 @@  type T struct {
 var x = 1
 var a1 = S { 0, X: 1 }	// ERROR "mixture|undefined"
 var a2 = S { Y: 3, Z: 2, Y: 3 } // ERROR "duplicate"
-var a3 = T { 1, 2, 3, 4, 5, 6 }	// ERROR "convert|too many"
+var a3 = T { S{}, 2, 3, 4, 5, 6 }	// ERROR "convert|too many"
 var a4 = [5]byte{ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }	// ERROR "index|too many"
 var a5 = []byte { x: 2 }	// ERROR "index"
 
Index: test/fixedbugs/bug361.go
===================================================================
--- test/fixedbugs/bug361.go	(revision 0)
+++ test/fixedbugs/bug361.go	(revision 0)
@@ -0,0 +1,15 @@ 
+// $G $D/$F.go || echo BUG: bug360
+
+// Copyright 2011 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 1908
+// unreasonable width used to be internal fatal error
+
+package test
+
+func main() {
+	buf := [1<<30]byte{}
+	_ = buf[:]
+}
Index: test/fixedbugs/bug335.go
===================================================================
--- test/fixedbugs/bug335.go	(revision 0)
+++ test/fixedbugs/bug335.go	(revision 0)
@@ -0,0 +1,10 @@ 
+// $G $D/$F.dir/b.go && $G $D/$F.dir/a.go
+// rm -f a.$A b.$A
+
+// Copyright 2011 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 1705.
+
+unused (see script at top of file)
Index: test/fixedbugs/bug228.go
===================================================================
--- test/fixedbugs/bug228.go	(revision 179018)
+++ test/fixedbugs/bug228.go	(working copy)
@@ -8,7 +8,7 @@  package main
 
 func f(x int, y ...int)	// ok
 
-func g(x int, y float) (...)	// ERROR "[.][.][.]"
+func g(x int, y float) (...)	// ERROR "[.][.][.]" "final argument"
 
 func h(x, y ...int)		// ERROR "[.][.][.]"
 
Index: test/fixedbugs/bug349.go
===================================================================
--- test/fixedbugs/bug349.go	(revision 0)
+++ test/fixedbugs/bug349.go	(revision 0)
@@ -0,0 +1,13 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1192 - detail in error
+
+package main
+
+func foo() (a, b, c int) {
+	return 0, 1 2.01  // ERROR "unexpected literal 2.01|expected ';' or '}' or newline|not enough arguments to return"
+}
Index: test/fixedbugs/bug330.go
===================================================================
--- test/fixedbugs/bug330.go	(revision 0)
+++ test/fixedbugs/bug330.go	(revision 0)
@@ -0,0 +1,13 @@ 
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 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
+
+func main() {
+	x := ""
+	x = +"hello"  // ERROR "invalid operation.*string|expected numeric"
+	x = +x  // ERROR "invalid operation.*string|expected numeric"
+}
Index: test/fixedbugs/bug344.go
===================================================================
--- test/fixedbugs/bug344.go	(revision 0)
+++ test/fixedbugs/bug344.go	(revision 0)
@@ -0,0 +1,24 @@ 
+// errchk $G -e $D/$F.go
+
+// Copyright 2011 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 "fmt"
+
+func main() {
+	// invalid use of goto.
+	// do whatever you like, just don't crash.
+	i := 42
+	a := []*int{&i, &i, &i, &i}
+	x := a[0]
+	goto start  // ERROR "jumps into block"
+	z := 1
+	_ = z
+	for _, x = range a {	// GCCGO_ERROR "block"
+	start:
+		fmt.Sprint(*x)
+	}
+}
Index: test/fixedbugs/bug358.go
===================================================================
--- test/fixedbugs/bug358.go	(revision 0)
+++ test/fixedbugs/bug358.go	(revision 0)
@@ -0,0 +1,26 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1979
+// used to get internal compiler error too
+
+package main
+
+import (
+	"http"
+	"io/ioutil"	// GCCGO_ERROR "imported and not used"
+	"os"
+)
+
+func makeHandler(fn func(http.ResponseWriter, *http.Request, string)) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request)  // ERROR "syntax error|invalid use of type"
+}
+
+type Page struct {
+	Title string
+	Body []byte
+}
+
Index: test/fixedbugs/bug353.go
===================================================================
--- test/fixedbugs/bug353.go	(revision 0)
+++ test/fixedbugs/bug353.go	(revision 0)
@@ -0,0 +1,30 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 2089 - internal compiler error
+
+package main
+
+import (
+	"io"
+	"os"
+)
+
+func echo(fd io.ReadWriterCloser) { // ERROR "undefined.*io.ReadWriterCloser"
+	var buf [1024]byte
+	for {
+		n, err := fd.Read(buf)
+		if err != nil {
+			break
+		}
+		fd.Write(buf[0:n])
+	}
+}
+
+func main() {
+	fd, _ := os.Open("a.txt")
+	echo(fd)
+}
Index: test/fixedbugs/bug327.go
===================================================================
--- test/fixedbugs/bug327.go	(revision 0)
+++ test/fixedbugs/bug327.go	(revision 0)
@@ -0,0 +1,24 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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.
+
+// Conversion between identical interfaces.
+// Issue 1647.
+
+// The compiler used to not realize this was a no-op,
+// so it generated a call to the non-existent function runtime.convE2E.
+
+package main
+
+type (
+	a interface{}
+	b interface{}
+)
+
+func main() {
+	x := a(1)
+	z := b(x)
+	_ = z
+}
Index: test/fixedbugs/bug322.go
===================================================================
--- test/fixedbugs/bug322.go	(revision 0)
+++ test/fixedbugs/bug322.go	(revision 0)
@@ -0,0 +1,8 @@ 
+// $G $D/$F.dir/lib.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out || echo BUG: fails incorrectly
+
+// Copyright 2011 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.
+
+// Test case for issue 1402.
+ignored
Index: test/fixedbugs/bug362.go
===================================================================
--- test/fixedbugs/bug362.go	(revision 0)
+++ test/fixedbugs/bug362.go	(revision 0)
@@ -0,0 +1,16 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1662
+// iota inside var
+
+package main
+
+var (
+	a = iota  // ERROR "undefined: iota|iota is only defined in const"
+	b = iota  // ERROR "undefined: iota|iota is only defined in const"
+	c = iota  // ERROR "undefined: iota|iota is only defined in const"
+)
Index: test/fixedbugs/bug336.go
===================================================================
--- test/fixedbugs/bug336.go	(revision 0)
+++ test/fixedbugs/bug336.go	(revision 0)
@@ -0,0 +1,86 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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
+
+type T1 struct {
+	Next *T2
+}
+
+type T2 T1
+
+type T3 struct {
+	Next *T4
+}
+
+type T4 T5
+type T5 T6
+type T6 T7
+type T7 T8
+type T8 T9
+type T9 T3
+
+type T10 struct {
+	x struct {
+		y ***struct {
+			z *struct {
+				Next *T11
+			}
+		}
+	}
+}
+
+type T11 T10
+
+type T12 struct {
+	F1 *T15
+	F2 *T13
+	F3 *T16
+}
+
+type T13 T14
+type T14 T15
+type T15 T16
+type T16 T17
+type T17 T12
+
+// issue 1672
+type T18 *[10]T19
+type T19 T18
+
+func main() {
+	_ = &T1{&T2{}}
+	_ = &T2{&T2{}}
+	_ = &T3{&T4{}}
+	_ = &T4{&T4{}}
+	_ = &T5{&T4{}}
+	_ = &T6{&T4{}}
+	_ = &T7{&T4{}}
+	_ = &T8{&T4{}}
+	_ = &T9{&T4{}}
+	_ = &T12{&T15{}, &T13{}, &T16{}}
+
+	var (
+		tn    struct{ Next *T11 }
+		tz    struct{ z *struct{ Next *T11 } }
+		tpz   *struct{ z *struct{ Next *T11 } }
+		tppz  **struct{ z *struct{ Next *T11 } }
+		tpppz ***struct{ z *struct{ Next *T11 } }
+		ty    struct {
+			y ***struct{ z *struct{ Next *T11 } }
+		}
+	)
+	tn.Next = &T11{}
+	tz.z = &tn
+	tpz = &tz
+	tppz = &tpz
+	tpppz = &tppz
+	ty.y = tpppz
+	_ = &T10{ty}
+
+	t19s := &[10]T19{}
+	_ = T18(t19s)
+}
Index: test/fixedbugs/bug229.go
===================================================================
--- test/fixedbugs/bug229.go	(revision 179018)
+++ test/fixedbugs/bug229.go	(working copy)
@@ -16,5 +16,5 @@  func main() {
 
 	t.ch = nil	// ERROR "unexported"
 	
-	println(testing.anyLowercaseName("asdf"))	// ERROR "unexported"
+	println(testing.anyLowercaseName("asdf"))	// ERROR "unexported" "undefined: testing.anyLowercaseName"
 }
Index: test/fixedbugs/bug322.dir/main.go
===================================================================
--- test/fixedbugs/bug322.dir/main.go	(revision 0)
+++ test/fixedbugs/bug322.dir/main.go	(revision 0)
@@ -0,0 +1,40 @@ 
+// Copyright 2011 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 "./lib"
+
+type I interface {
+	M()
+}
+
+type PI interface {
+	PM()
+}
+
+func main() {
+	var t lib.T
+	t.M()
+	t.PM()
+
+	// This is still an error.
+	// var i1 I = t
+	// i1.M()
+	
+	// This combination is illegal because
+	// PM requires a pointer receiver.
+	// var pi1 PI = t
+	// pi1.PM()
+
+	var pt = &t
+	pt.M()
+	pt.PM()
+
+	var i2 I = pt
+	i2.M()
+
+	var pi2 PI = pt
+	pi2.PM()
+}
Index: test/fixedbugs/bug322.dir/lib.go
===================================================================
--- test/fixedbugs/bug322.dir/lib.go	(revision 0)
+++ test/fixedbugs/bug322.dir/lib.go	(revision 0)
@@ -0,0 +1,15 @@ 
+// Copyright 2011 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 lib
+
+type T struct {
+	x int  // non-exported field
+}
+
+func (t T) M() {
+}
+
+func (t *T) PM() {
+}
Index: test/fixedbugs/bug331.go
===================================================================
--- test/fixedbugs/bug331.go	(revision 0)
+++ test/fixedbugs/bug331.go	(revision 0)
@@ -0,0 +1,36 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug331
+
+// Copyright 2011 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 f() (_ string, x float64, err os.Error) {
+	return
+}
+
+func g() (_ string, x float64, err os.Error) {
+	return "hello", 3.14, os.EOF
+}
+
+var _ func() (string, float64, os.Error) = f
+var _ func() (string, float64, os.Error) = g
+
+func main() {
+	x, y, z := g()
+	if x != "hello" || y != 3.14 || z != os.EOF {
+		println("wrong", x, len(x), y, z)
+	}
+}
+
+/*
+issue 1712
+
+bug331.go:12: cannot use "hello" (type string) as type float64 in assignment
+bug331.go:12: cannot use 0 (type float64) as type os.Error in assignment:
+	float64 does not implement os.Error (missing String method)
+bug331.go:12: error in shape across RETURN
+*/
Index: test/fixedbugs/bug345.go
===================================================================
--- test/fixedbugs/bug345.go	(revision 0)
+++ test/fixedbugs/bug345.go	(revision 0)
@@ -0,0 +1,7 @@ 
+// $G $D/$F.dir/io.go && errchk $G -e $D/$F.dir/main.go
+
+// Copyright 2011 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 ignored
Index: test/fixedbugs/bug238.go
===================================================================
--- test/fixedbugs/bug238.go	(revision 179018)
+++ test/fixedbugs/bug238.go	(working copy)
@@ -19,4 +19,3 @@  const h bool = false
 const i int = 2
 const j float64 = 5
 
-func main() { println(a, b, c, d, e, f, g) }
Index: test/fixedbugs/bug359.go
===================================================================
--- test/fixedbugs/bug359.go	(revision 0)
+++ test/fixedbugs/bug359.go	(revision 0)
@@ -0,0 +1,26 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1910
+// error on wrong line
+
+package main
+
+import "container/list"
+
+type Painting struct {
+	fragments list.List // private
+}
+
+func (p Painting) Foo() {
+	for e := p.fragments; e.Front() != nil; {  // ERROR "unexported field|hidden field"
+	}
+}
+
+// from comment 4 of issue 1910
+type Foo interface {
+	Run(a int) (a int)  // ERROR "a redeclared|redefinition|previous"
+}
Index: test/fixedbugs/bug335.dir/a.go
===================================================================
--- test/fixedbugs/bug335.dir/a.go	(revision 0)
+++ test/fixedbugs/bug335.dir/a.go	(revision 0)
@@ -0,0 +1,9 @@ 
+// Copyright 2011 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
+
+import "./b"
+
+var Bar = b.Foo
Index: test/fixedbugs/bug335.dir/b.go
===================================================================
--- test/fixedbugs/bug335.dir/b.go	(revision 0)
+++ test/fixedbugs/bug335.dir/b.go	(revision 0)
@@ -0,0 +1,11 @@ 
+// Copyright 2011 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 b
+
+type T interface{}
+
+func f() T { return nil }
+
+var Foo T = f()
Index: test/fixedbugs/bug340.go
===================================================================
--- test/fixedbugs/bug340.go	(revision 0)
+++ test/fixedbugs/bug340.go	(revision 0)
@@ -0,0 +1,17 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1606.
+
+package main
+
+func main() {
+	var x interface{}
+	switch t := x.(type) { // ERROR "0 is not a type"
+	case 0:
+		t.x = 1 // ERROR "type interface \{ \}"
+	}
+}
Index: test/fixedbugs/bug273.go
===================================================================
--- test/fixedbugs/bug273.go	(revision 179018)
+++ test/fixedbugs/bug273.go	(working copy)
@@ -47,15 +47,6 @@  func bigcap() {
 	g1 = make([]int, 10, big)
 }
 
-const (
-	addrBits = 8*uint(unsafe.Sizeof((*byte)(nil)))
-	sh = addrBits/2 - 2
-)
-var g2 [][1<<sh][1<<sh]byte
-func overflow() {
-	g2 = make([][1<<sh][1<<sh]byte, 64)
-}
-
 var g3 map[int]int
 func badmapcap() {
 	g3 = make(map[int]int, minus1)
@@ -74,6 +65,8 @@  func bigchancap() {
 	g4 = make(chan int, big)
 }
 
+const addrBits = unsafe.Sizeof((*byte)(nil))
+
 var g5 chan [1<<15]byte
 func overflowchan() {
 	if addrBits == 32 {
@@ -92,7 +85,6 @@  func main() {
 	shouldfail(badcap, "badcap")
 	shouldfail(badcap1, "badcap1")
 	shouldfail(bigcap, "bigcap")
-	shouldfail(overflow, "overflow")
 	shouldfail(badmapcap, "badmapcap")
 	shouldfail(bigmapcap, "bigmapcap")
 	shouldfail(badchancap, "badchancap")
Index: test/fixedbugs/bug354.go
===================================================================
--- test/fixedbugs/bug354.go	(revision 0)
+++ test/fixedbugs/bug354.go	(revision 0)
@@ -0,0 +1,26 @@ 
+// $G $D/$F.go || echo BUG: bug354
+
+// Copyright 2011 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 2086
+// was calling makeclosure twice on the closure
+
+package main
+
+import (
+	"os"
+)
+
+type Inner struct {
+	F func() os.Error
+}
+
+type Outer struct {
+	Inners []Inner
+}
+
+// calls makeclosure twice on same closure
+
+var Foo = Outer{[]Inner{Inner{func() os.Error{ return nil }}}}
Index: test/fixedbugs/bug328.go
===================================================================
--- test/fixedbugs/bug328.go	(revision 0)
+++ test/fixedbugs/bug328.go	(revision 0)
@@ -0,0 +1,14 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 "unsafe"
+
+func main() {
+	var p unsafe.Pointer
+	println(p)
+}
Index: test/fixedbugs/bug363.go
===================================================================
--- test/fixedbugs/bug363.go	(revision 0)
+++ test/fixedbugs/bug363.go	(revision 0)
@@ -0,0 +1,21 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1664
+
+package main
+
+func main() {
+	var i uint = 33
+	var a = (1<<i) + 4.5  // ERROR "shift of type float64|invalid.*shift"
+	println(a)
+	
+	var b = (1<<i) + 4.0  // ERROR "shift of type float64|invalid.*shift"
+	println(b)
+
+	var c int64 = (1<<i) + 4.0  // ok - it's all int64
+	println(b)
+}
Index: test/fixedbugs/bug337.go
===================================================================
--- test/fixedbugs/bug337.go	(revision 0)
+++ test/fixedbugs/bug337.go	(revision 0)
@@ -0,0 +1,19 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1722.
+
+// Check that the error messages says 
+//	bug337.go:16: len("foo") not used
+// and not
+//	bug337.go:16: 3 not used
+
+package main
+
+func main() {
+	len("foo")	// ERROR "len|value computed is not used"
+}
+
Index: test/fixedbugs/bug332.go
===================================================================
--- test/fixedbugs/bug332.go	(revision 0)
+++ test/fixedbugs/bug332.go	(revision 0)
@@ -0,0 +1,17 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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
+
+// type T int
+
+func main() {}
+
+// issue 1474
+
+// important: no newline on end of next line.
+// 6g used to print <epoch> instead of bug332.go:111 
+func (t *T) F() {} // ERROR "bug332"
\ No newline at end of file
Index: test/fixedbugs/bug346.go
===================================================================
--- test/fixedbugs/bug346.go	(revision 0)
+++ test/fixedbugs/bug346.go	(revision 0)
@@ -0,0 +1,19 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: issue2056
+
+// Copyright 2011 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 main() {
+	x := 4
+	a, b, c, d := func(i int) (p int, q int, r int, s int) { return 1, i, 3, x }(2)
+
+	if a != 1 || b != 2 || c != 3 || d != 4 {
+		println("abcd: expected 1 2 3 4 got", a, b, c, d)
+		os.Exit(1)
+	}
+}
Index: test/fixedbugs/bug341.go
===================================================================
--- test/fixedbugs/bug341.go	(revision 0)
+++ test/fixedbugs/bug341.go	(revision 0)
@@ -0,0 +1,22 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug341
+
+// Copyright 2011 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.
+
+// Used to panic because 8g was generating incorrect
+// code for converting a negative float to a uint64.
+
+package main
+
+func main() {
+	var x float32 = -2.5
+
+	_ = uint64(x)
+	_ = float32(0)
+}
+/*
+panic: runtime error: floating point error
+
+[signal 0x8 code=0x6 addr=0x8048c64 pc=0x8048c64]
+*/
Index: test/fixedbugs/bug355.go
===================================================================
--- test/fixedbugs/bug355.go	(revision 0)
+++ test/fixedbugs/bug355.go	(revision 0)
@@ -0,0 +1,18 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 f = func() int {
+	type S int
+	return 42
+}
+
+func main() {
+	if f() != 42 {
+		panic("BUG: bug355")
+	}
+}
Index: test/fixedbugs/bug274.go
===================================================================
--- test/fixedbugs/bug274.go	(revision 179018)
+++ test/fixedbugs/bug274.go	(working copy)
@@ -25,6 +25,7 @@  func main() {
 		L1:  // ERROR "statement"
 	default:
 		     // correct since no semicolon is required before a '}'
-		L2:  // GCCGO_ERROR "not used"
+		goto L2
+		L2:
 	}
 }
Index: test/fixedbugs/bug329.go
===================================================================
--- test/fixedbugs/bug329.go	(revision 0)
+++ test/fixedbugs/bug329.go	(revision 0)
@@ -0,0 +1,46 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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
+
+type Value struct {
+	X interface{}
+	Y int
+}
+
+type Struct struct {
+	X complex128
+}
+
+const magic = 1 + 2i
+
+func (Value) Complex(x complex128) {
+	if x != magic {
+		println(x)
+		panic("bad complex magic")
+	}
+}
+
+func f(x *byte, y, z int) complex128 {
+	return magic
+}
+
+func (Value) Struct(x Struct) {
+	if x.X != magic {
+		println(x.X)
+		panic("bad struct magic")
+	}
+}
+
+func f1(x *byte, y, z int) Struct {
+	return Struct{magic}
+}
+
+func main() {
+	var v Value
+	v.Struct(f1(nil, 0, 0)) // ok
+	v.Complex(f(nil, 0, 0)) // used to fail
+}
Index: test/fixedbugs/bug350.go
===================================================================
--- test/fixedbugs/bug350.go	(revision 0)
+++ test/fixedbugs/bug350.go	(revision 0)
@@ -0,0 +1,15 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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
+
+type T int
+
+func (T) m() {}
+func (T) m() {} // ERROR "T[.]m redeclared"
+
+func (*T) p() {}
+func (*T) p() {} // ERROR "[(][*]T[)][.]p redeclared"
Index: test/fixedbugs/bug324.go
===================================================================
--- test/fixedbugs/bug324.go	(revision 0)
+++ test/fixedbugs/bug324.go	(revision 0)
@@ -0,0 +1,8 @@ 
+// $G $D/$F.dir/p.go && $G $D/$F.dir/main.go && $L main.$A && ./$A.out
+
+// Copyright 2011 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.
+
+// Test case for issue 1550
+ignored
Index: test/fixedbugs/bug364.go
===================================================================
--- test/fixedbugs/bug364.go	(revision 0)
+++ test/fixedbugs/bug364.go	(revision 0)
@@ -0,0 +1,25 @@ 
+package main
+
+import "fmt"
+
+var s string
+
+func accum(args ...interface{}) {
+	s += fmt.Sprintln(args...)
+}
+
+func f(){
+	v := 0.0
+	for i := 0; i < 3; i++ {
+		v += 0.1
+		defer accum(v)
+	}
+}
+
+func main() {
+	f()
+	if s != "0.30000000000000004\n0.2\n0.1\n" {
+		println("BUG: defer")
+		print(s)
+	}
+}
Index: test/fixedbugs/bug338.go
===================================================================
--- test/fixedbugs/bug338.go	(revision 0)
+++ test/fixedbugs/bug338.go	(revision 0)
@@ -0,0 +1,22 @@ 
+// $G $D/$F.go
+
+// Copyright 2011 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 1787.
+
+package main
+
+import "unsafe"
+
+const x = unsafe.Sizeof([8]byte{})
+
+func main() {
+	var b [x]int
+	_ = b
+}
+
+/*
+bug338.go:14: array bound must be non-negative
+*/
Index: test/fixedbugs/bug297.go
===================================================================
--- test/fixedbugs/bug297.go	(revision 179018)
+++ test/fixedbugs/bug297.go	(working copy)
@@ -11,5 +11,5 @@  package main
 type ByteSize float64
 const (
 	_ = iota;   // ignore first value by assigning to blank identifier
-	KB ByteSize = 1<<(10*X) // ERROR "undefined"
+	KB ByteSize = 1<<(10*X) // ERROR "undefined" "as type ByteSize"
 )
Index: test/fixedbugs/bug345.dir/main.go
===================================================================
--- test/fixedbugs/bug345.dir/main.go	(revision 0)
+++ test/fixedbugs/bug345.dir/main.go	(revision 0)
@@ -0,0 +1,28 @@ 
+// Copyright 2011 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 (
+	"bufio"
+	"./io"
+	goio "io"
+)
+
+func main() {
+	// The errors here complain that io.X != io.X
+	// for different values of io so they should be
+	// showing the full import path, which for the
+	// "./io" import is really ..../go/test/io.
+	// For example:
+	//
+	// main.go:25: cannot use w (type "/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".Writer) as type "io".Writer in function argument:
+	//	io.Writer does not implement io.Writer (missing Write method)
+	// main.go:27: cannot use &x (type *"io".SectionReader) as type *"/Users/rsc/g/go/test/fixedbugs/bug345.dir/io".SectionReader in function argument
+
+	var w io.Writer
+	bufio.NewWriter(w)  // ERROR "test/io"
+	var x goio.SectionReader
+	io.SR(&x)  // ERROR "test/io"
+}
Index: test/fixedbugs/bug345.dir/io.go
===================================================================
--- test/fixedbugs/bug345.dir/io.go	(revision 0)
+++ test/fixedbugs/bug345.dir/io.go	(revision 0)
@@ -0,0 +1,15 @@ 
+// Copyright 2011 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 io
+
+type Writer interface {
+	WrongWrite()
+}
+
+type SectionReader struct {
+	X int
+}
+
+func SR(*SectionReader) {}
Index: test/fixedbugs/bug333.go
===================================================================
--- test/fixedbugs/bug333.go	(revision 0)
+++ test/fixedbugs/bug333.go	(revision 0)
@@ -0,0 +1,19 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 1709
+
+package main
+
+func main() {
+       type Ts string
+       var ts Ts
+       _ = []byte(ts)
+}
+
+/*
+bug333.go:14: cannot use ts (type Ts) as type string in function argument
+*/
Index: test/fixedbugs/bug347.go
===================================================================
--- test/fixedbugs/bug347.go	(revision 0)
+++ test/fixedbugs/bug347.go	(revision 0)
@@ -0,0 +1,49 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 (
+	"runtime"
+	"strings"
+)
+
+var t *struct {
+	c chan int
+}
+
+var c chan int
+
+func f() {
+	select {
+	case <-t.c:  // THIS IS LINE 22
+		break
+	case <-c:
+		break
+	}
+}
+
+func main() {
+	defer func() {
+		recover()
+		for i := 0;; i++ {
+			pc, file, line, ok := runtime.Caller(i)
+			if !ok {
+				print("BUG: bug347: cannot find caller\n")
+				return
+			}
+			if !strings.Contains(file, "bug347.go") || runtime.FuncForPC(pc).Name() != "main.f" {
+				// walk past runtime frames
+				continue
+			}
+			if line != 22 {
+				print("BUG: bug347: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
+			}
+			return
+		}
+	}()
+	f()
+}
Index: test/fixedbugs/bug342.go
===================================================================
--- test/fixedbugs/bug342.go	(revision 0)
+++ test/fixedbugs/bug342.go	(revision 0)
@@ -0,0 +1,24 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1871.
+
+package p
+
+type a interface {
+	foo(x int) (x int) // ERROR "redeclared|redefinition"
+}
+
+var b interface {
+	bar(y int) (y int) // ERROR "redeclared|redefinition"
+}
+
+/*
+Previously:
+
+bug.go:1 x redclared in this block
+    previous declaration at bug.go:1
+*/
Index: test/fixedbugs/bug356.go
===================================================================
--- test/fixedbugs/bug356.go	(revision 0)
+++ test/fixedbugs/bug356.go	(revision 0)
@@ -0,0 +1,41 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug344
+
+// Copyright 2011 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 1808
+
+package main
+
+func main() {
+	var i uint64
+	var x int = 12345
+
+	if y := x << (i&5); y != 12345<<0 {
+		println("BUG bug344", y)
+		return
+	}
+	
+	i++
+	if y := x << (i&5); y != 12345<<1 {
+		println("BUG bug344a", y)
+	}
+	
+	i = 70
+	if y := x << i; y != 0 {
+		println("BUG bug344b", y)
+	}
+	
+	i = 1<<32
+	if y := x << i; y != 0 {
+		println("BUG bug344c", y)
+	}
+}
+	
+
+/*
+typecheck [1008592b0]
+.   INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
+bug343.go:15: internal compiler error: typecheck INDREG
+*/
Index: test/fixedbugs/bug324.dir/p.go
===================================================================
--- test/fixedbugs/bug324.dir/p.go	(revision 0)
+++ test/fixedbugs/bug324.dir/p.go	(revision 0)
@@ -0,0 +1,15 @@ 
+// Copyright 2011 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 p
+
+type Exported interface {
+	private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() { println("p.Implementation.private()") }
+
+var X = new(Implementation)
Index: test/fixedbugs/bug324.dir/main.go
===================================================================
--- test/fixedbugs/bug324.dir/main.go	(revision 0)
+++ test/fixedbugs/bug324.dir/main.go	(revision 0)
@@ -0,0 +1,53 @@ 
+// Copyright 2011 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 (
+	"./p"
+)
+
+type Exported interface {
+	private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() {}
+
+
+func main() {
+	// nothing unusual here
+	var x Exported
+	x = new(Implementation)
+	x.private()  //  main.Implementation.private()
+
+	// same here - should be and is legal
+	var px p.Exported
+	px = p.X
+	
+	// this assignment is correctly illegal:
+	//	px.private undefined (cannot refer to unexported field or method private)
+	// px.private()
+
+	// this assignment is correctly illegal:
+	//	*Implementation does not implement p.Exported (missing p.private method)
+	// px = new(Implementation)
+
+	// this assignment is correctly illegal:
+	//	p.Exported does not implement Exported (missing private method)
+	// x = px
+
+	// this assignment unexpectedly compiles and then executes
+	defer func() {
+		recover()
+	}()
+	x = px.(Exported)
+	
+	println("should not get this far")
+
+	// this is a legitimate call, but because of the previous assignment,
+	// it invokes the method private in p!
+	x.private()  // p.Implementation.private()
+}
Index: test/fixedbugs/bug351.go
===================================================================
--- test/fixedbugs/bug351.go	(revision 0)
+++ test/fixedbugs/bug351.go	(revision 0)
@@ -0,0 +1,13 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 int
+
+func main() {
+	(x) := 0  // ERROR "non-name [(]x[)]"
+}
Index: test/fixedbugs/bug365.go
===================================================================
--- test/fixedbugs/bug365.go	(revision 0)
+++ test/fixedbugs/bug365.go	(revision 0)
@@ -0,0 +1,22 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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.
+
+// check that compiler doesn't stop reading struct def
+// after first unknown type.
+
+// Fixes issue 2110.
+
+package main
+
+type S struct {
+	err os.Error  // ERROR "undefined|expected package"
+	Num int
+}
+
+func main() {
+	s := S{}
+	_ = s.Num  // no error here please
+}
Index: test/fixedbugs/bug339.go
===================================================================
--- test/fixedbugs/bug339.go	(revision 0)
+++ test/fixedbugs/bug339.go	(revision 0)
@@ -0,0 +1,20 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 1608.
+// Size used to be -1000000000.
+
+package main
+
+import "unsafe"
+
+func main() {
+	var a interface{} = 0
+	size := unsafe.Sizeof(a)
+	if size != 2*unsafe.Sizeof((*int)(nil)) {
+		println("wrong size: ", size)
+	}
+}
Index: test/fixedbugs/bug298.go
===================================================================
--- test/fixedbugs/bug298.go	(revision 179018)
+++ test/fixedbugs/bug298.go	(working copy)
@@ -7,5 +7,5 @@ 
 package ddd
 
 func Sum() int
-	for i := range []int{} { return i }  // ERROR "return outside function|expected"
+	for i := range []int{} { return i }  // ERROR "statement outside function|expected"
 
Index: test/fixedbugs/bug334.go
===================================================================
--- test/fixedbugs/bug334.go	(revision 0)
+++ test/fixedbugs/bug334.go	(revision 0)
@@ -0,0 +1,31 @@ 
+// $G $D/$F.go || echo BUG: bug334
+
+// Copyright 2011 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 1716
+
+package main
+
+type (
+	cplx64  complex64
+	cplx128 complex128
+)
+
+func (c cplx64) Foo()  {}
+func (c cplx128) Foo() {}
+
+func main() {
+	var c64 cplx128
+	var c128 cplx64
+	c64.Foo()
+	c128.Foo()
+}
+
+/*
+bug334.go:16: invalid receiver type cplx64
+bug334.go:17: invalid receiver type cplx128
+bug334.go:22: c64.Foo undefined (type cplx128 has no field or method Foo)
+bug334.go:23: c128.Foo undefined (type cplx64 has no field or method Foo)
+*/
Index: test/fixedbugs/bug348.go
===================================================================
--- test/fixedbugs/bug348.go	(revision 0)
+++ test/fixedbugs/bug348.go	(revision 0)
@@ -0,0 +1,46 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 (
+	"runtime"
+	"strings"
+)
+
+func f() {
+	var x *string
+	
+	for _, i := range *x {  // THIS IS LINE 17
+		println(i)
+	}
+}
+
+func g() {
+}
+
+func main() {
+	defer func() {
+		for i := 0;; i++ {
+			pc, file, line, ok := runtime.Caller(i)
+			if !ok {
+				print("BUG: bug348: cannot find caller\n")
+				return
+			}
+			if !strings.Contains(file, "bug348.go") || runtime.FuncForPC(pc).Name() != "main.f" {
+				// walk past runtime frames
+				continue
+			}
+			if line != 17 {
+				print("BUG: bug348: panic at ", file, ":", line, " in ", runtime.FuncForPC(pc).Name(), "\n")
+				return
+			}
+			recover()
+			return
+		}
+	}()
+	f()
+}
Index: test/fixedbugs/bug343.go
===================================================================
--- test/fixedbugs/bug343.go	(revision 0)
+++ test/fixedbugs/bug343.go	(revision 0)
@@ -0,0 +1,33 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug343
+
+// Copyright 2011 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 1900
+
+package main
+
+func getArgs(data map[string]interface{}, keys ...string) map[string]string {
+       ret := map[string]string{}
+       var ok bool
+       for _, k := range keys {
+               ret[k], ok = data[k].(string)
+               if !ok {}
+       }
+       return ret
+}
+
+func main() {
+	x := getArgs(map[string]interface{}{"x":"y"}, "x")
+	if x["x"] != "y" {
+		println("BUG bug343", x)
+	}
+}
+	
+
+/*
+typecheck [1008592b0]
+.   INDREG a(1) l(15) x(24) tc(2) runtime.ret G0 string
+bug343.go:15: internal compiler error: typecheck INDREG
+*/
Index: test/fixedbugs/bug357.go
===================================================================
--- test/fixedbugs/bug357.go	(revision 0)
+++ test/fixedbugs/bug357.go	(revision 0)
@@ -0,0 +1,26 @@ 
+// errchk $G $D/$F.go
+
+// Copyright 2011 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 1993.
+// error used to have last line number in file
+
+package main
+
+func bla1() bool {
+	return false
+}
+
+func bla5() bool {
+	_ = 1
+	false  // ERROR "false not used|value computed is not used"
+	_ = 2
+	return false
+}
+
+func main() {
+	x := bla1()
+	_ = x
+}
Index: test/fixedbugs/bug231.go
===================================================================
--- test/fixedbugs/bug231.go	(revision 179018)
+++ test/fixedbugs/bug231.go	(working copy)
@@ -17,6 +17,6 @@  func main() {
 	var i I
 	
 	i = m
-	i = t	// ERROR "not a method|has no methods"
+	i = t	// ERROR "not a method|has no methods" "does not implement I"
 	_ = i
 }
Index: test/fixedbugs/bug205.go
===================================================================
--- test/fixedbugs/bug205.go	(revision 179018)
+++ test/fixedbugs/bug205.go	(working copy)
@@ -12,7 +12,7 @@  var m map[string]int;
 
 func main() {
 	println(t["hi"]);	// ERROR "integer"
-	println(s["hi"]);	// ERROR "integer"
+	println(s["hi"]);	// ERROR "integer" "to type uint"
 	println(m[0]);	// ERROR "map index"
 }
 
Index: test/fixedbugs/bug352.go
===================================================================
--- test/fixedbugs/bug352.go	(revision 0)
+++ test/fixedbugs/bug352.go	(revision 0)
@@ -0,0 +1,19 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out || echo BUG: bug352
+
+// Copyright 2011 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 [10][0]byte
+var y = make([]struct{}, 10)
+
+func main() {
+	if &x[1] != &x[2] {
+		println("BUG: bug352 [0]byte")
+	}
+	if &y[1] != &y[2] {
+		println("BUG: bug352 struct{}")
+	}
+}
Index: test/divide.go
===================================================================
--- test/divide.go	(revision 0)
+++ test/divide.go	(revision 0)
@@ -0,0 +1,54 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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.
+
+// divide corner cases
+
+package main
+
+import "fmt"
+
+func f8(x, y, q, r int8) {
+	if t := x / y; t != q {
+		fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+	}
+	if t := x % y; t != r {
+		fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+	}
+}
+
+func f16(x, y, q, r int16) {
+	if t := x / y; t != q {
+		fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+	}
+	if t := x % y; t != r {
+		fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+	}
+}
+
+func f32(x, y, q, r int32) {
+	if t := x / y; t != q {
+		fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+	}
+	if t := x % y; t != r {
+		fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+	}
+}
+
+func f64(x, y, q, r int64) {
+	if t := x / y; t != q {
+		fmt.Printf("%d/%d = %d, want %d\n", x, y, t, q)
+	}
+	if t := x % y; t != r {
+		fmt.Printf("%d%%%d = %d, want %d\n", x, y, t, r)
+	}
+}
+
+func main() {
+	f8(-1<<7, -1, -1<<7, 0)
+	f16(-1<<15, -1, -1<<15, 0)
+	f32(-1<<31, -1, -1<<31, 0)
+	f64(-1<<63, -1, -1<<63, 0)
+}
Index: test/bench/regex-dna-parallel.go
===================================================================
--- test/bench/regex-dna-parallel.go	(revision 179018)
+++ test/bench/regex-dna-parallel.go	(working copy)
@@ -89,7 +89,7 @@  func countMatches(pat string, bytes []by
 
 func main() {
 	runtime.GOMAXPROCS(4)
-	bytes, err := ioutil.ReadFile("/dev/stdin")
+	bytes, err := ioutil.ReadAll(os.Stdin)
 	if err != nil {
 		fmt.Fprintf(os.Stderr, "can't read input: %s\n", err)
 		os.Exit(2)
Index: test/bench/regex-dna.go
===================================================================
--- test/bench/regex-dna.go	(revision 179018)
+++ test/bench/regex-dna.go	(working copy)
@@ -87,7 +87,7 @@  func countMatches(pat string, bytes []by
 }
 
 func main() {
-	bytes, err := ioutil.ReadFile("/dev/stdin")
+	bytes, err := ioutil.ReadAll(os.Stdin)
 	if err != nil {
 		fmt.Fprintf(os.Stderr, "can't read input: %s\n", err)
 		os.Exit(2)
Index: test/bench/timing.log
===================================================================
--- test/bench/timing.log	(revision 179018)
+++ test/bench/timing.log	(working copy)
@@ -674,3 +674,229 @@  threadring 50000000
 	gcc -O2 threadring.c	30.50u 258.05s 325.72r
 	gccgo -O2 threadring.go	92.87u 748.39s 728.46r
 	gc threadring	38.03u 0.01s 38.04r
+
+# Apr 15, 2011
+# Move to new machine, Intel Xeon E5520@2.27GHz.
+# (Was Opteron(tm) Processor 8214 HE)
+
+fasta -n 25000000
+OLD:
+	gcc -O2 fasta.c	3.39u 0.04s 3.42r
+	gccgo -O2 fasta.go	3.52u 0.00s 3.52r
+	gc fasta	3.63u 0.04s 3.67r
+	gc_B fasta	3.66u 0.00s 3.66r
+NEW:
+	gcc -O2 fasta.c	1.45u 0.02s 1.47r
+	gccgo -O2 fasta.go	1.51u 0.01s 1.51r
+	gc fasta	2.04u 0.00s 2.04r
+	gc_B fasta	2.05u 0.00s 2.04r
+
+reverse-complement < output-of-fasta-25000000
+OLD:
+	gcc -O2 reverse-complement.c	1.87u 1.51s 7.02r
+	gccgo -O2 reverse-complement.go	1.56u 0.54s 3.37r
+	gc reverse-complement	1.73u 0.36s 2.08r
+	gc_B reverse-complement	1.75u 0.37s 2.12r
+NEW:
+	gcc -O2 reverse-complement.c	1.20u 0.47s 12.96r
+	gccgo -O2 reverse-complement.go	0.88u 0.14s 1.01r
+	gc reverse-complement	1.13u 0.17s 1.30r
+	gc_B reverse-complement	1.11u 0.09s 1.20r
+
+nbody -n 50000000
+OLD:
+	gcc -O2 -lm nbody.c	21.90u 0.00s 21.92r
+	gccgo -O2 nbody.go	23.12u 0.03s 23.19r
+	gc nbody	29.07u 0.00s 29.07r
+	gc_B nbody	31.84u 0.00s 31.85r
+NEW:
+	gcc -O2 -lm nbody.c	13.01u 0.00s 13.03r
+	gccgo -O2 nbody.go	13.35u 0.00s 13.37r
+	gc nbody	21.78u 0.00s 21.82r
+	gc_B nbody	21.72u 0.00s 21.76r
+
+binary-tree 15 # too slow to use 20
+OLD:
+	gcc -O2 binary-tree.c -lm	0.83u 0.02s 0.84r
+	gccgo -O2 binary-tree.go	2.61u 0.02s 2.62r
+	gccgo -O2 binary-tree-freelist.go	0.32u 0.01s 0.32r
+	gc binary-tree	3.93u 0.04s 3.97r
+	gc binary-tree-freelist	0.47u 0.03s 0.50r
+NEW:
+	gcc -O2 binary-tree.c -lm	0.60u 0.00s 0.59r
+	gccgo -O2 binary-tree.go	1.53u 0.00s 1.52r
+	gccgo -O2 binary-tree-freelist.go	0.01u 0.00s 0.00r
+	gc binary-tree	1.93u 0.02s 1.95r
+	gc binary-tree-freelist	0.32u 0.01s 0.32r
+
+fannkuch 12
+OLD:
+	gcc -O2 fannkuch.c	57.64u 0.00s 57.64r
+	gccgo -O2 fannkuch.go	65.56u 0.01s 65.65r
+	gccgo -O2 fannkuch-parallel.go	179.12u 0.00s 49.82r
+	gc fannkuch	126.39u 0.00s 126.39r
+	gc fannkuch-parallel	172.49u 0.02s 45.44r
+	gc_B fannkuch	89.30u 0.00s 89.28r
+NEW:
+	gcc -O2 fannkuch.c	45.17u 0.00s 45.26r
+	gccgo -O2 fannkuch.go	53.63u 0.00s 53.73r
+	gccgo -O2 fannkuch-parallel.go	216.72u 0.00s 58.42r
+	gc fannkuch	108.21u 0.00s 108.44r
+	gc fannkuch-parallel	227.20u 0.00s 57.27r
+	gc_B fannkuch	56.14u 0.00s 56.26r
+
+regex-dna 100000
+OLD:
+	gcc -O2 regex-dna.c -lpcre	0.77u 0.01s 0.78r
+	gccgo -O2 regex-dna.go	10.15u 0.02s 10.23r
+	gccgo -O2 regex-dna-parallel.go	33.81u 3.22s 11.62r
+	gc regex-dna	6.52u 0.04s 6.56r
+	gc regex-dna-parallel	6.84u 0.03s 2.70r
+	gc_B regex-dna	6.83u 0.01s 6.84r
+NEW:
+	gcc -O2 regex-dna.c -lpcre	0.47u 0.00s 0.47r
+	gccgo -O2 regex-dna.go	6.00u 0.00s 6.00r
+	gccgo -O2 regex-dna-parallel.go	44.54u 1.57s 6.51r
+	gc regex-dna	5.41u 0.01s 5.42r
+	gc regex-dna-parallel	5.62u 0.01s 2.20r
+	gc_B regex-dna	5.50u 0.00s 5.50r
+
+spectral-norm 5500
+OLD:
+	gcc -O2 spectral-norm.c -lm	12.29u 0.00s 12.28r
+	gccgo -O2 spectral-norm.go	11.56u 0.00s 11.55r
+	gc spectral-norm	23.98u 0.00s 24.00r
+	gc_B spectral-norm	24.62u 0.00s 24.65r
+NEW:
+	gcc -O2 spectral-norm.c -lm	15.79u 0.00s 15.82r
+	gccgo -O2 spectral-norm.go	15.32u 0.00s 15.35r
+	gc spectral-norm	19.62u 0.01s 19.67r
+	gc_B spectral-norm	19.62u 0.00s 19.66r
+
+k-nucleotide 1000000
+OLD:
+	gcc -O2 k-nucleotide.c	9.82u 0.06s 9.87r
+	gccgo -O2 k-nucleotide.go	8.30u 0.02s 8.32r
+	gccgo -O2 k-nucleotide-parallel.go	8.84u 0.05s 3.02r
+	gc k-nucleotide	15.38u 0.07s 15.44r
+	gc k-nucleotide-parallel	16.40u 0.03s 5.93r
+	gc_B k-nucleotide	15.19u 0.05s 15.23r
+NEW:
+	gcc -O2 -k-nucleotide.c	4.88u 0.03s 4.92r
+	gccgo -O2 k-nucleotide.go	5.94u 0.01s 5.96r
+	gccgo -O2 k-nucleotide-parallel.go	6.44u 0.03s 1.47r
+	gc k-nucleotide	9.61u 0.01s 9.63r
+	gc k-nucleotide-parallel	9.70u 0.00s 3.39r
+	gc_B k-nucleotide	9.19u 0.03s 9.23r
+
+mandelbrot 16000
+OLD:
+	gcc -O2 mandelbrot.c	54.54u 0.00s 54.56r
+	gccgo -O2 mandelbrot.go	59.63u 0.03s 59.67r
+	gc mandelbrot	64.82u 0.00s 64.83r
+	gc_B mandelbrot	64.84u 0.00s 64.91r
+NEW:
+	gcc -O2 mandelbrot.c	36.07u 0.01s 36.15r
+	gccgo -O2 mandelbrot.go	43.57u 0.00s 43.66r
+	gc mandelbrot	60.66u 0.00s 60.79r
+	gc_B mandelbrot	60.90u 0.00s 61.03r
+
+meteor 2098
+OLD:
+	gcc -O2 meteor-contest.c	0.11u 0.00s 0.10r
+	gccgo -O2 meteor-contest.go	0.10u 0.01s 0.10r
+	gc meteor-contest	0.18u 0.00s 0.17r
+	gc_B meteor-contest	0.17u 0.00s 0.16r
+NEW:
+	gcc -O2 meteor-contest.c	0.10u 0.00s 0.09r
+	gccgo -O2 meteor-contest.go	0.10u 0.00s 0.09r
+	gc meteor-contest	0.14u 0.00s 0.14r
+	gc_B meteor-contest	0.13u 0.00s 0.13r
+
+pidigits 10000
+OLD:
+	gcc -O2 pidigits.c -lgmp	2.22u 0.00s 2.21r
+	gccgo -O2 pidigits.go	13.39u 0.00s 13.40r
+	gc pidigits	6.42u 0.04s 6.45r
+	gc_B pidigits	6.45u 0.02s 6.47r
+NEW:
+	gcc -O2 pidigits.c -lgmp	2.27u 0.00s 2.29r
+	gccgo -O2 pidigits.go	9.21u 0.00s 9.22r
+	gc pidigits	3.60u 0.00s 3.60r
+	gc_B pidigits	3.56u 0.02s 3.58r
+
+threadring 50000000
+OLD:
+	gcc -O2 threadring.c -lpthread	34.51u 267.95s 336.12r
+	gccgo -O2 threadring.go	103.51u 588.57s 627.16r
+	gc threadring	54.68u 0.00s 54.73r
+NEW:
+	gcc -O2 threadring.c 32.00u 259.39s 369.74r
+	gccgo -O2 threadring.go	133.06u 546.02s 595.33r
+	gc threadring	16.75u 0.02s 16.80r
+
+chameneos 6000000
+OLD:
+	gcc -O2 chameneosredux.c -lpthread	12.65u 31.02s 13.33r
+	gccgo -O2 chameneosredux.go	47.04u 302.84s 252.29r
+	gc chameneosredux	14.14u 0.00s 14.14r
+NEW:
+	gcc -O2 chameneosredux.c -lpthread	8.05u 63.43s 11.16r
+	gccgo -O2 chameneosredux.go	82.95u 304.37s 207.64r
+	gc chameneosredux	9.42u 0.00s 9.43r
+
+# May 13, 2011
+# after gc update to inline append when possible - 35% faster
+
+regex-dna 100000
+	gc regex-dna	3.94u 0.00s 3.95r
+	gc regex-dna-parallel	4.15u 0.01s 1.63r
+	gc_B regex-dna	4.01u 0.01s 4.02r
+
+# Aug 4, 2011
+# After various updates to locking code and some runtime changes.
+# Slowdowns believed due to slower (but more correct) memmove.
+
+fannkuch 12
+	gccgo -O2 fannkuch.go	51.59u 0.00s 51.69r # -4%
+	gccgo -O2 fannkuch-parallel.go	253.17u 0.00s 64.67r # -11%
+	gc fannkuch	103.14u 0.00s 103.36r # -5%
+	gc fannkuch-parallel	189.63u 0.00s 49.37r # +9%
+	gc_B fannkuch	49.19u 0.00s 49.29r # -14%
+
+regex-dna 100000
+	gc regex-dna	3.78u 0.00s 3.78r # -43%
+	gc regex-dna-parallel	3.84u 0.02s 1.48r # -49%
+	gc_B regex-dna	3.62u 0.00s 3.63r # -52%
+
+k-nucleotide 1000000
+	gc k-nucleotide	12.23u 0.02s 12.27r # +27%
+	gc k-nucleotide-parallel	12.76u 0.02s 4.37r # +29%
+	gc_B k-nucleotide	12.18u 0.01s 12.21r # +33%
+
+threadring 50000000
+	gc threadring	17.49u 0.00s 17.53r # +4%
+
+chameneos 6000000
+	gc chameneosredux	7.61u 0.00s 7.63r # -24%
+
+Aug 9, 2011
+# After custom algorithms for 1- 2- 4- 8-byte scalars.
+
+fannkuch 12
+	gc fannkuch-parallel	157.17u 0.00s 41.08r # -17%
+
+k-nucleotide 1000000
+	gc k-nucleotide	8.72u 0.03s 8.76r # -39%
+	gc k-nucleotide-parallel	8.79u 0.01s 3.14r # -39%
+	gc_B k-nucleotide	8.65u 0.03s 8.69r # -39%
+
+pidigits 10000
+	gc pidigits	3.71u 0.02s 3.73r # +4%
+	gc_B pidigits	3.73u 0.00s 3.73r # +4%
+
+threadring 50000000
+	gc threadring	14.51u 0.00s 14.54r # -17%
+
+chameneos 6000000
+	gc chameneosredux	7.41u 0.00s 7.42r # -3%
Index: test/func6.go
===================================================================
--- test/func6.go	(revision 0)
+++ test/func6.go	(revision 0)
@@ -0,0 +1,14 @@ 
+// $G $D/$F.go
+
+// Copyright 2011 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
+
+func main() {
+	if func() bool { return true }() {}  // 6g used to say this was a syntax error
+	if (func() bool { return true })() {}
+	if (func() bool { return true }()) {}
+}
+
Index: test/chan/select6.go
===================================================================
--- test/chan/select6.go	(revision 0)
+++ test/chan/select6.go	(revision 0)
@@ -0,0 +1,34 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 2075
+// A bug in select corrupts channel queues of failed cases
+// if there are multiple waiters on those channels and the
+// select is the last in the queue. If further waits are made
+// on the channel without draining it first then those waiters
+// will never wake up. In the code below c1 is such a channel.
+
+package main
+
+func main() {
+	c1 := make(chan bool)
+	c2 := make(chan bool)
+	c3 := make(chan bool)
+	go func() { <-c1 }()
+	go func() {
+		select {
+		case <-c1:
+			panic("dummy")
+		case <-c2:
+			c3 <- true
+		}
+		<-c1
+	}()
+	go func() { c2 <- true }()
+	<-c3
+	c1 <- true
+	c1 <- true
+}
Index: test/chan/zerosize.go
===================================================================
--- test/chan/zerosize.go	(revision 0)
+++ test/chan/zerosize.go	(revision 0)
@@ -0,0 +1,16 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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.
+
+// Making channels of a zero-sized type should not panic.
+
+package main
+
+func main() {
+	_ = make(chan [0]byte)
+	_ = make(chan [0]byte, 1)
+	_ = make(chan struct{})
+	_ = make(chan struct{}, 1)
+}
Index: test/nul1.go
===================================================================
--- test/nul1.go	(revision 179018)
+++ test/nul1.go	(working copy)
@@ -39,7 +39,7 @@  var y = ` + "`in raw string \x00 foo`" +
 
 /* in other comment ` + "\x00" + ` */ // ERROR "NUL"
 
-/* in source code */ ` + "\x00" + `// ERROR "NUL"
+/* in source code */ ` + "\x00" + `// ERROR "NUL" "illegal character"
 
 var xx = "in string ` + "\xc2\xff" + `" // ERROR "UTF-8"
 
@@ -50,9 +50,9 @@  var yy = ` + "`in raw string \xff foo`" 
 /* in other comment ` + "\xe0\x00\x00" + ` */ // ERROR "UTF-8|NUL"
 
 /* in variable name */
-var z` + "\xc1\x81" + ` int // ERROR "UTF-8"
+var z` + "\xc1\x81" + ` int // ERROR "UTF-8" "invalid identifier character"
 
-/* in source code */ ` + "\xc2A" + `// ERROR "UTF-8"
+/* in source code */ ` + "var \xc2A int" + `// ERROR "UTF-8" "invalid identifier character"
 
 `)
 }
Index: test/goprint.go
===================================================================
--- test/goprint.go	(revision 0)
+++ test/goprint.go	(revision 0)
@@ -0,0 +1,14 @@ 
+// $G $D/$F.go && $L $F.$A && ./$A.out
+
+// Copyright 2011 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 "time"
+
+func main() {
+	go println(42, true, false, true, 1.5, "world", (chan int)(nil), []int(nil), (map[string]int)(nil), (func())(nil), byte(255))
+	time.Sleep(1e6)
+}
Index: test/interface/pointer.go
===================================================================
--- test/interface/pointer.go	(revision 179018)
+++ test/interface/pointer.go	(working copy)
@@ -33,4 +33,5 @@  func main() {
 	print("call addinst\n")
 	var x Inst = AddInst(new(Start)) // ERROR "pointer to interface"
 	print("return from  addinst\n")
+	var y *Inst = new(Start)  // ERROR "pointer to interface|incompatible type"
 }
Index: test/interface/explicit.go
===================================================================
--- test/interface/explicit.go	(revision 179018)
+++ test/interface/explicit.go	(working copy)
@@ -48,7 +48,7 @@  func main() {
 	i2 = I2(i) // ERROR "invalid|missing N method"
 
 	e = E(t) // ok
-	t = T(e) // ERROR "need explicit|need type assertion|incompatible"
+	t = T(e) // ERROR "need explicit|need type assertion|incompatible" "as type [*]T"
 }
 
 type M interface {
Index: test/interface/private1.go
===================================================================
--- test/interface/private1.go	(revision 0)
+++ test/interface/private1.go	(revision 0)
@@ -0,0 +1,18 @@ 
+// true  # used by private.go
+
+// Copyright 2011 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 p
+
+type Exported interface {
+	private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() {}
+
+var X = new(Implementation)
+
Index: test/interface/private.go
===================================================================
--- test/interface/private.go	(revision 0)
+++ test/interface/private.go	(revision 0)
@@ -0,0 +1,32 @@ 
+// $G $D/${F}1.go && errchk $G $D/$F.go
+
+// Copyright 2011 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 "./private1"
+
+type Exported interface {
+	private()
+}
+
+type Implementation struct{}
+
+func (p *Implementation) private() {}
+
+func main() {
+	var x Exported
+	x = new(Implementation)
+	x.private()
+
+	var px p.Exported
+	px = p.X
+
+	px.private()			// ERROR "private"
+
+	px = new(Implementation)	// ERROR "private"
+
+	x = px				// ERROR "private"
+}
Index: test/shift2.go
===================================================================
--- test/shift2.go	(revision 0)
+++ test/shift2.go	(revision 0)
@@ -0,0 +1,42 @@ 
+// $G $D/$F.go || echo BUG: shift2
+
+// Copyright 2011 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 1708, legal cases.
+
+package p
+
+func f(x int) int         { return 0 }
+func g(x interface{}) int { return 0 }
+func h(x float64) int     { return 0 }
+
+// from the spec
+var (
+	s uint  = 33
+	i       = 1 << s         // 1 has type int
+	j int32 = 1 << s         // 1 has type int32; j == 0
+	k       = uint64(1 << s) // 1 has type uint64; k == 1<<33
+	m int   = 1.0 << s       // legal: 1.0 has type int
+	w int64 = 1.0 << 33      // legal: 1.0<<33 is a constant shift expression
+)
+
+// non-constant shift expressions
+var (
+	a1 int = 2.0 << s    // typeof(2.0) is int in this context => legal shift
+	d1     = f(2.0 << s) // typeof(2.0) is int in this context => legal shift
+)
+
+// constant shift expressions
+const c uint = 5
+
+var (
+	a2 int     = 2.0 << c    // a2 == 64 (type int)
+	b2         = 2.0 << c    // b2 == 64 (untyped integer)
+	_          = f(b2)       // verify b2 has type int
+	c2 float64 = 2 << c      // c2 == 64.0 (type float64)
+	d2         = f(2.0 << c) // == f(64)
+	e2         = g(2.0 << c) // == g(int(64))
+	f2         = h(2 << c)   // == h(float64(64.0))
+)
Index: go-test.exp
===================================================================
--- go-test.exp	(revision 179018)
+++ go-test.exp	(working copy)
@@ -81,6 +81,12 @@  proc errchk { test opts } {
 	    set index [string first "dg-error" $out_line]
 	    regsub -all "\\\[\\.\\\]" $out_line "\\\\\[.\\\\\]" out_line
 	}
+	# Special case for bug332, in which the error message wants to
+	# match the file name, which is not what dg-error expects.
+	if [string match "*dg-error*bug332*" $out_line] {
+	    set index [string first "dg-error" $out_line]
+	    regsub -start $index "bug332" $out_line "undefined type" out_line
+	}
 	puts $fdout $out_line
     }
     close $fdin
@@ -258,6 +264,13 @@  proc go-gc-tests { } {
 	    }
 	}
 
+	if { [string match "*bug347*" $test] \
+		 || [string match "*bug348*" $test] } {
+	    # These bugs rely on runtime.Caller which currently fails.
+	    untested $name
+	    continue
+	}
+
 	set fd [open $test r]
 
 	set lines_ok 1
@@ -451,15 +464,23 @@  proc go-gc-tests { } {
 			$test_line] \
 		       || [string match \
 			       "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
+			       $test_line] \
+		       || [string match \
+			       "// \$G \$D/\$F.dir/b.go && \$G \$D/\$F.dir/a.go" \
 			       $test_line] } {
 	    if { [string match \
+		      "// \$G \$D/\$F.dir/bug0.go && errchk \$G \$D/\$F.dir/bug1.go" \
+		      $test_line] } {
+		set name1 "bug0.go"
+		set name2 "bug1.go"
+	    } elseif { [string match \
 		      "// \$G \$D/\$F.dir/p1.go && \$G \$D/\$F.dir/p2.go" \
 		      $test_line] } {
 		set name1 "p1.go"
 		set name2 "p2.go"
 	    } else {
-		set name1 "bug0.go"
-		set name2 "bug1.go"
+		set name1 "b.go"
+		set name2 "a.go"
 	    }
 	    set hold_runtests $runtests
 	    set runtests "go-test.exp"