[Pkg-golang-commits] [golang] 01/03: Imported Upstream version 1.1.2

Michael Stapelberg michael at stapelberg.de
Mon Aug 19 20:31:51 UTC 2013


This is an automated email from the git hooks/post-receive script.

stapelberg pushed a commit to branch debian-sid
in repository golang.

commit b901efe83e212f0c34c769c079e41373da12d723
Author: Michael Stapelberg <michael at stapelberg.de>
Date:   Tue Aug 13 13:44:24 2013 +0200

    Imported Upstream version 1.1.2
---
 VERSION                                            |    2 +-
 doc/devel/release.html                             |   11 ++++
 misc/cgo/test/callback.go                          |    4 ++
 src/cmd/6g/peep.c                                  |    1 +
 src/cmd/8g/ggen.c                                  |    2 +-
 src/cmd/8g/peep.c                                  |    1 +
 src/cmd/cgo/out.go                                 |   68 ++++++++++++++++++--
 src/cmd/gc/closure.c                               |    7 +-
 src/cmd/gc/export.c                                |    5 ++
 src/cmd/gc/fmt.c                                   |    2 +-
 src/cmd/gc/walk.c                                  |    7 ++
 src/pkg/bufio/bufio.go                             |   17 +++--
 src/pkg/bufio/bufio_test.go                        |   22 +++++++
 src/pkg/runtime/proc.c                             |    2 +
 src/pkg/runtime/time.goc                           |    5 ++
 src/pkg/syscall/rlimit_linux_test.go               |   41 ++++++++++++
 src/pkg/syscall/syscall_linux_386.go               |    4 +-
 src/pkg/syscall/syscall_linux_arm.go               |    4 +-
 src/pkg/time/sleep_test.go                         |   20 ++++++
 test/fixedbugs/bug465.dir/a.go                     |   15 +++++
 test/fixedbugs/bug465.dir/b.go                     |    2 +-
 test/fixedbugs/issue5753.go                        |   29 +++++++++
 test/fixedbugs/issue5755.dir/a.go                  |   60 +++++++++++++++++
 .../{issue5105.dir/b.go => issue5755.dir/main.go}  |   18 ++++--
 test/fixedbugs/{issue4879.go => issue5755.go}      |    4 +-
 test/fixedbugs/issue5809.go                        |   27 ++++++++
 test/fixedbugs/{issue4620.go => issue5820.go}      |   15 ++---
 test/fixedbugs/{issue5002.go => issue5841.go}      |    6 +-
 28 files changed, 361 insertions(+), 40 deletions(-)

diff --git a/VERSION b/VERSION
index c9c892d..58a8503 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-go1.1.1
\ No newline at end of file
+go1.1.2
\ No newline at end of file
diff --git a/doc/devel/release.html b/doc/devel/release.html
index babd6e2..d31f793 100644
--- a/doc/devel/release.html
+++ b/doc/devel/release.html
@@ -28,6 +28,17 @@ go1.1.1 (released 2013/06/13) includes several compiler and runtime bug fixes.
 See the <a href="https://code.google.com/p/go/source/list?name=release-branch.go1.1&r=43c4a41d24382a56a90e924800c681e435d9e399">change history</a> for details.
 </p>
 
+<p>
+go1.1.2 (released 2013/08/13) includes fixes to the <code>gc</code> compiler
+and <code>cgo</code>, and the <code>bufio</code>, <code>runtime</code>,
+<code>syscall</code>, and <code>time</code> packages.
+See the <a href="https://code.google.com/p/go/source/list?name=release-branch.go1.1&r=a6a9792f94acd4ff686b2bc57383d163608b91cf">change history</a> for details.
+If you use package syscall's <code>Getrlimit</code> and <code>Setrlimit</code>
+functions under Linux on the ARM or 386 architectures, please note change
+<a href="http://golang.org/change/55ac276af5a7">55ac276af5a7</a>
+that fixes <a href="http://golang.org/issue/5949">issue 5949</a>.
+</p>
+
 <h2 id="go1">go1 (released 2012/03/28)</h2>
 
 <p>
diff --git a/misc/cgo/test/callback.go b/misc/cgo/test/callback.go
index b6e2e3c..c642d5f 100644
--- a/misc/cgo/test/callback.go
+++ b/misc/cgo/test/callback.go
@@ -142,6 +142,10 @@ func testBlocking(t *testing.T) {
 // Test that the stack can be unwound through a call out and call back
 // into Go.
 func testCallbackCallers(t *testing.T) {
+	if runtime.Compiler != "gc" {
+		// The exact function names are not going to be the same.
+		t.Skip("skipping for non-gc toolchain")
+	}
 	pc := make([]uintptr, 100)
 	n := 0
 	name := []string{
diff --git a/src/cmd/6g/peep.c b/src/cmd/6g/peep.c
index bb24d41..cd2881e 100644
--- a/src/cmd/6g/peep.c
+++ b/src/cmd/6g/peep.c
@@ -152,6 +152,7 @@ peep(void)
 		case ALEAQ:
 			if(regtyp(&p->to))
 			if(p->from.sym != S)
+			if(p->from.index == D_NONE || p->from.index == D_CONST)
 				conprop(r);
 			break;
 
diff --git a/src/cmd/8g/ggen.c b/src/cmd/8g/ggen.c
index 7014810..b0154bb 100644
--- a/src/cmd/8g/ggen.c
+++ b/src/cmd/8g/ggen.c
@@ -78,9 +78,9 @@ clearfat(Node *nl)
 	c = w % 4;	// bytes
 	q = w / 4;	// quads
 
-	gconreg(AMOVL, 0, D_AX);
 	nodreg(&n1, types[tptr], D_DI);
 	agen(nl, &n1);
+	gconreg(AMOVL, 0, D_AX);
 
 	if(q >= 4) {
 		gconreg(AMOVL, q, D_CX);
diff --git a/src/cmd/8g/peep.c b/src/cmd/8g/peep.c
index e5a3149..b8a1eaa 100644
--- a/src/cmd/8g/peep.c
+++ b/src/cmd/8g/peep.c
@@ -145,6 +145,7 @@ peep(void)
 		case ALEAL:
 			if(regtyp(&p->to))
 			if(p->from.sym != S)
+			if(p->from.index == D_NONE || p->from.index == D_CONST)
 				conprop(r);
 			break;
 
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
index ee1d891..7fb8181 100644
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -318,6 +318,9 @@ func (p *Package) writeDefsFunc(fc, fgo2 *os.File, n *Name) {
 		Type: gtype,
 	}
 
+	// Builtins defined in the C prolog.
+	inProlog := name == "CString" || name == "GoString" || name == "GoStringN" || name == "GoBytes"
+
 	if *gccgo {
 		// Gccgo style hooks.
 		fmt.Fprint(fgo2, "\n")
@@ -331,8 +334,10 @@ func (p *Package) writeDefsFunc(fc, fgo2 *os.File, n *Name) {
 
 		conf.Fprint(fgo2, fset, d)
 		fmt.Fprint(fgo2, " {\n")
-		fmt.Fprint(fgo2, "\tdefer syscall.CgocallDone()\n")
-		fmt.Fprint(fgo2, "\tsyscall.Cgocall()\n")
+		if !inProlog {
+			fmt.Fprint(fgo2, "\tdefer syscall.CgocallDone()\n")
+			fmt.Fprint(fgo2, "\tsyscall.Cgocall()\n")
+		}
 		if n.AddError {
 			fmt.Fprint(fgo2, "\tsyscall.SetErrno(0)\n")
 		}
@@ -363,7 +368,11 @@ func (p *Package) writeDefsFunc(fc, fgo2 *os.File, n *Name) {
 		fmt.Fprint(fgo2, "}\n")
 
 		// declare the C function.
-		fmt.Fprintf(fgo2, "//extern %s\n", n.C)
+		if inProlog {
+			fmt.Fprintf(fgo2, "//extern %s\n", n.C)
+		} else {
+			fmt.Fprintf(fgo2, "//extern _cgo%s%s\n", cPrefix, n.Mangle)
+		}
 		d.Name = ast.NewIdent(cname)
 		if n.AddError {
 			l := d.Type.Results.List
@@ -377,8 +386,7 @@ func (p *Package) writeDefsFunc(fc, fgo2 *os.File, n *Name) {
 	conf.Fprint(fgo2, fset, d)
 	fmt.Fprint(fgo2, "\n")
 
-	if name == "CString" || name == "GoString" || name == "GoStringN" || name == "GoBytes" {
-		// The builtins are already defined in the C prolog.
+	if inProlog {
 		return
 	}
 
@@ -466,7 +474,7 @@ func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) {
 	p.Written[name] = true
 
 	if *gccgo {
-		// we don't use wrappers with gccgo.
+		p.writeGccgoOutputFunc(fgcc, n)
 		return
 	}
 
@@ -518,6 +526,54 @@ func (p *Package) writeOutputFunc(fgcc *os.File, n *Name) {
 	fmt.Fprintf(fgcc, "\n")
 }
 
+// Write out a wrapper for a function when using gccgo.  This is a
+// simple wrapper that just calls the real function.  We only need a
+// wrapper to support static functions in the prologue--without a
+// wrapper, we can't refer to the function, since the reference is in
+// a different file.
+func (p *Package) writeGccgoOutputFunc(fgcc *os.File, n *Name) {
+	if t := n.FuncType.Result; t != nil {
+		fmt.Fprintf(fgcc, "%s\n", t.C.String())
+	} else {
+		fmt.Fprintf(fgcc, "void\n")
+	}
+	fmt.Fprintf(fgcc, "_cgo%s%s(", cPrefix, n.Mangle)
+	for i, t := range n.FuncType.Params {
+		if i > 0 {
+			fmt.Fprintf(fgcc, ", ")
+		}
+		c := t.Typedef
+		if c == "" {
+			c = t.C.String()
+		}
+		fmt.Fprintf(fgcc, "%s p%d", c, i)
+	}
+	fmt.Fprintf(fgcc, ")\n")
+	fmt.Fprintf(fgcc, "{\n")
+	fmt.Fprintf(fgcc, "\t")
+	if t := n.FuncType.Result; t != nil {
+		fmt.Fprintf(fgcc, "return ")
+		// Cast to void* to avoid warnings due to omitted qualifiers.
+		if c := t.C.String(); c[len(c)-1] == '*' {
+			fmt.Fprintf(fgcc, "(void*)")
+		}
+	}
+	fmt.Fprintf(fgcc, "%s(", n.C)
+	for i, t := range n.FuncType.Params {
+		if i > 0 {
+			fmt.Fprintf(fgcc, ", ")
+		}
+		// Cast to void* to avoid warnings due to omitted qualifiers.
+		if c := t.C.String(); c[len(c)-1] == '*' {
+			fmt.Fprintf(fgcc, "(void*)")
+		}
+		fmt.Fprintf(fgcc, "p%d", i)
+	}
+	fmt.Fprintf(fgcc, ");\n")
+	fmt.Fprintf(fgcc, "}\n")
+	fmt.Fprintf(fgcc, "\n")
+}
+
 // Write out the various stubs we need to support functions exported
 // from Go so that they are callable from C.
 func (p *Package) writeExports(fgo2, fc, fm *os.File) {
diff --git a/src/cmd/gc/closure.c b/src/cmd/gc/closure.c
index d81c528..996504a 100644
--- a/src/cmd/gc/closure.c
+++ b/src/cmd/gc/closure.c
@@ -280,7 +280,7 @@ typecheckpartialcall(Node *fn, Node *sym)
 static Node*
 makepartialcall(Node *fn, Type *t0, Node *meth)
 {
-	Node *ptr, *n, *fld, *call, *xtype, *xfunc, *cv;
+	Node *ptr, *n, *fld, *call, *xtype, *xfunc, *cv, *savecurfn;
 	Type *rcvrtype, *basetype, *t;
 	NodeList *body, *l, *callargs, *retargs;
 	char *p;
@@ -304,6 +304,9 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
 	if(sym->flags & SymUniq)
 		return sym->def;
 	sym->flags |= SymUniq;
+	
+	savecurfn = curfn;
+	curfn = N;
 
 	xtype = nod(OTFUNC, N, N);
 	i = 0;
@@ -311,6 +314,7 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
 	callargs = nil;
 	ddd = 0;
 	xfunc = nod(ODCLFUNC, N, N);
+	curfn = xfunc;
 	for(t = getinargx(t0)->type; t; t = t->down) {
 		snprint(namebuf, sizeof namebuf, "a%d", i++);
 		n = newname(lookup(namebuf));
@@ -385,6 +389,7 @@ makepartialcall(Node *fn, Type *t0, Node *meth)
 	typecheck(&xfunc, Etop);
 	sym->def = xfunc;
 	xtop = list(xtop, xfunc);
+	curfn = savecurfn;
 
 	return xfunc;
 }
diff --git a/src/cmd/gc/export.c b/src/cmd/gc/export.c
index 4a9b8c8..caac330 100644
--- a/src/cmd/gc/export.c
+++ b/src/cmd/gc/export.c
@@ -161,6 +161,11 @@ reexportdep(Node *n)
 	case OCONV:
 	case OCONVIFACE:
 	case OCONVNOP:
+	case ORUNESTR:
+	case OARRAYBYTESTR:
+	case OARRAYRUNESTR:
+	case OSTRARRAYBYTE:
+	case OSTRARRAYRUNE:
 	case ODOTTYPE:
 	case ODOTTYPE2:
 	case OSTRUCTLIT:
diff --git a/src/cmd/gc/fmt.c b/src/cmd/gc/fmt.c
index 35f01a5..b5f6a9b 100644
--- a/src/cmd/gc/fmt.c
+++ b/src/cmd/gc/fmt.c
@@ -1218,7 +1218,7 @@ exprfmt(Fmt *f, Node *n, int prec)
 		}
 		if(fmtmode == FExp && ptrlit)
 			// typecheck has overwritten OIND by OTYPE with pointer type.
-			return fmtprint(f, "&%T{ %,H }", n->right->type->type, n->list);
+			return fmtprint(f, "(&%T{ %,H })", n->right->type->type, n->list);
 		return fmtprint(f, "(%N{ %,H })", n->right, n->list);
 
 	case OPTRLIT:
diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c
index d9c6341..e8ebd28 100644
--- a/src/cmd/gc/walk.c
+++ b/src/cmd/gc/walk.c
@@ -1338,6 +1338,13 @@ walkexpr(Node **np, NodeList **init)
 	fatal("missing switch %O", n->op);
 
 ret:
+	// Expressions that are constant at run time but not
+	// considered const by the language spec are not turned into
+	// constants until walk. For example, if n is y%1 == 0, the
+	// walk of y%1 may have replaced it by 0.
+	// Check whether n with its updated args is itself now a constant.
+	evconst(n);
+
 	ullmancalc(n);
 
 	if(debug['w'] && n != N)
diff --git a/src/pkg/bufio/bufio.go b/src/pkg/bufio/bufio.go
index df3501f..10e12d4 100644
--- a/src/pkg/bufio/bufio.go
+++ b/src/pkg/bufio/bufio.go
@@ -585,23 +585,28 @@ func (b *Writer) ReadFrom(r io.Reader) (n int64, err error) {
 	}
 	var m int
 	for {
+		if b.Available() == 0 {
+			if err1 := b.Flush(); err1 != nil {
+				return n, err1
+			}
+		}
 		m, err = r.Read(b.buf[b.n:])
 		if m == 0 {
 			break
 		}
 		b.n += m
 		n += int64(m)
-		if b.Available() == 0 {
-			if err1 := b.Flush(); err1 != nil {
-				return n, err1
-			}
-		}
 		if err != nil {
 			break
 		}
 	}
 	if err == io.EOF {
-		err = nil
+		// If we filled the buffer exactly, flush pre-emptively.
+		if b.Available() == 0 {
+			err = b.Flush()
+		} else {
+			err = nil
+		}
 	}
 	return n, err
 }
diff --git a/src/pkg/bufio/bufio_test.go b/src/pkg/bufio/bufio_test.go
index 79ed0f1..9fcbfda 100644
--- a/src/pkg/bufio/bufio_test.go
+++ b/src/pkg/bufio/bufio_test.go
@@ -847,6 +847,10 @@ func TestWriterReadFrom(t *testing.T) {
 				t.Errorf("ws[%d],rs[%d]: w.ReadFrom(r) = %d, %v, want %d, nil", wi, ri, n, err, len(input))
 				continue
 			}
+			if err := w.Flush(); err != nil {
+				t.Errorf("Flush returned %v", err)
+				continue
+			}
 			if got, want := b.String(), string(input); got != want {
 				t.Errorf("ws[%d], rs[%d]:\ngot  %q\nwant %q\n", wi, ri, got, want)
 			}
@@ -1003,6 +1007,24 @@ func TestReaderClearError(t *testing.T) {
 	}
 }
 
+// Test for golang.org/issue/5947
+func TestWriterReadFromWhileFull(t *testing.T) {
+	buf := new(bytes.Buffer)
+	w := NewWriterSize(buf, 10)
+
+	// Fill buffer exactly.
+	n, err := w.Write([]byte("0123456789"))
+	if n != 10 || err != nil {
+		t.Fatalf("Write returned (%v, %v), want (10, nil)", n, err)
+	}
+
+	// Use ReadFrom to read in some data.
+	n2, err := w.ReadFrom(strings.NewReader("abcdef"))
+	if n2 != 6 || err != nil {
+		t.Fatalf("ReadFrom returned (%v, %v), want (6, nil)", n, err)
+	}
+}
+
 // An onlyReader only implements io.Reader, no matter what other methods the underlying implementation may have.
 type onlyReader struct {
 	r io.Reader
diff --git a/src/pkg/runtime/proc.c b/src/pkg/runtime/proc.c
index 31876b6..5734509 100644
--- a/src/pkg/runtime/proc.c
+++ b/src/pkg/runtime/proc.c
@@ -1371,6 +1371,8 @@ runtime·exitsyscall(void)
 		runtime·unlock(&runtime·sched);
 		if(p) {
 			acquirep(p);
+			m->p->tick++;
+			g->status = Grunning;
 			g->gcstack = (uintptr)nil;
 			g->gcsp = (uintptr)nil;
 			return;
diff --git a/src/pkg/runtime/time.goc b/src/pkg/runtime/time.goc
index 6de989f..be0c1f8 100644
--- a/src/pkg/runtime/time.goc
+++ b/src/pkg/runtime/time.goc
@@ -131,6 +131,11 @@ runtime·deltimer(Timer *t)
 {
 	int32 i;
 
+	// Dereference t so that any panic happens before the lock is held.
+	// Discard result, because t might be moving in the heap.
+	i = t->i;
+	USED(i);
+
 	runtime·lock(&timers);
 
 	// t may not be registered anymore and may have
diff --git a/src/pkg/syscall/rlimit_linux_test.go b/src/pkg/syscall/rlimit_linux_test.go
new file mode 100644
index 0000000..4ec720e
--- /dev/null
+++ b/src/pkg/syscall/rlimit_linux_test.go
@@ -0,0 +1,41 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package syscall_test
+
+import (
+	"syscall"
+	"testing"
+)
+
+func TestRlimit(t *testing.T) {
+	var rlimit, zero syscall.Rlimit
+	err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
+	if err != nil {
+		t.Fatalf("Getrlimit: save failed: %v", err)
+	}
+	if zero == rlimit {
+		t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
+	}
+	set := rlimit
+	set.Cur = set.Max - 1
+	err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &set)
+	if err != nil {
+		t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
+	}
+	var get syscall.Rlimit
+	err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &get)
+	if err != nil {
+		t.Fatalf("Getrlimit: get failed: %v", err)
+	}
+	set = rlimit
+	set.Cur = set.Max - 1
+	if set != get {
+		t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
+	}
+	err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit)
+	if err != nil {
+		t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
+	}
+}
diff --git a/src/pkg/syscall/syscall_linux_386.go b/src/pkg/syscall/syscall_linux_386.go
index a0ded43..a616956 100644
--- a/src/pkg/syscall/syscall_linux_386.go
+++ b/src/pkg/syscall/syscall_linux_386.go
@@ -78,7 +78,7 @@ const rlimInf32 = ^uint32(0)
 const rlimInf64 = ^uint64(0)
 
 func Getrlimit(resource int, rlim *Rlimit) (err error) {
-	err = prlimit(0, resource, rlim, nil)
+	err = prlimit(0, resource, nil, rlim)
 	if err != ENOSYS {
 		return err
 	}
@@ -106,7 +106,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
 
 func Setrlimit(resource int, rlim *Rlimit) (err error) {
-	err = prlimit(0, resource, nil, rlim)
+	err = prlimit(0, resource, rlim, nil)
 	if err != ENOSYS {
 		return err
 	}
diff --git a/src/pkg/syscall/syscall_linux_arm.go b/src/pkg/syscall/syscall_linux_arm.go
index 7839d52..4aadf9e 100644
--- a/src/pkg/syscall/syscall_linux_arm.go
+++ b/src/pkg/syscall/syscall_linux_arm.go
@@ -119,7 +119,7 @@ const rlimInf32 = ^uint32(0)
 const rlimInf64 = ^uint64(0)
 
 func Getrlimit(resource int, rlim *Rlimit) (err error) {
-	err = prlimit(0, resource, rlim, nil)
+	err = prlimit(0, resource, nil, rlim)
 	if err != ENOSYS {
 		return err
 	}
@@ -147,7 +147,7 @@ func Getrlimit(resource int, rlim *Rlimit) (err error) {
 //sysnb setrlimit(resource int, rlim *rlimit32) (err error) = SYS_SETRLIMIT
 
 func Setrlimit(resource int, rlim *Rlimit) (err error) {
-	err = prlimit(0, resource, nil, rlim)
+	err = prlimit(0, resource, rlim, nil)
 	if err != ENOSYS {
 		return err
 	}
diff --git a/src/pkg/time/sleep_test.go b/src/pkg/time/sleep_test.go
index 1322f06..603adc9 100644
--- a/src/pkg/time/sleep_test.go
+++ b/src/pkg/time/sleep_test.go
@@ -314,3 +314,23 @@ func TestOverflowSleep(t *testing.T) {
 		t.Fatalf("negative timeout didn't fire")
 	}
 }
+
+// Test that a panic while deleting a timer does not leave
+// the timers mutex held, deadlocking a ticker.Stop in a defer.
+func TestIssue5745(t *testing.T) {
+	ticker := NewTicker(Hour)
+	defer func() {
+		// would deadlock here before the fix due to
+		// lock taken before the segfault.
+		ticker.Stop()
+
+		if r := recover(); r == nil {
+			t.Error("Expected panic, but none happened.")
+		}
+	}()
+
+	// cause a panic due to a segfault
+	var timer *Timer
+	timer.Stop()
+	t.Error("Should be unreachable.")
+}
diff --git a/test/fixedbugs/bug465.dir/a.go b/test/fixedbugs/bug465.dir/a.go
index c5d410d..a9a8614 100644
--- a/test/fixedbugs/bug465.dir/a.go
+++ b/test/fixedbugs/bug465.dir/a.go
@@ -59,3 +59,18 @@ func F7() int {
 	}
 	return 0
 }
+
+func F8() int {
+	if a := (&T{1, 1}); a != nil {
+		return 1
+	}
+	return 0
+}
+
+func F9() int {
+	var a *T
+	if a = (&T{1, 1}); a != nil {
+		return 1
+	}
+	return 0
+}
diff --git a/test/fixedbugs/bug465.dir/b.go b/test/fixedbugs/bug465.dir/b.go
index 0f4909f..c84c683 100644
--- a/test/fixedbugs/bug465.dir/b.go
+++ b/test/fixedbugs/bug465.dir/b.go
@@ -9,7 +9,7 @@ import "./a"
 func main() {
 	for _, f := range []func() int{
 		a.F1, a.F2, a.F3, a.F4,
-		a.F5, a.F6, a.F7} {
+		a.F5, a.F6, a.F7, a.F8, a.F9} {
 		if f() > 1 {
 			panic("f() > 1")
 		}
diff --git a/test/fixedbugs/issue5753.go b/test/fixedbugs/issue5753.go
new file mode 100644
index 0000000..230a1e8
--- /dev/null
+++ b/test/fixedbugs/issue5753.go
@@ -0,0 +1,29 @@
+// run
+
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 5753: bad typecheck info causes escape analysis to
+// not run on method thunks.
+
+package main
+
+type Thing struct{}
+
+func (t *Thing) broken(s string) []string {
+	foo := [1]string{s}
+	return foo[:]
+}
+
+func main() {
+	t := &Thing{}
+
+	f := t.broken
+	s := f("foo")
+	_ = f("bar")
+	if s[0] != "foo" {
+		panic(`s[0] != "foo"`)
+	}
+	
+}
diff --git a/test/fixedbugs/issue5755.dir/a.go b/test/fixedbugs/issue5755.dir/a.go
new file mode 100644
index 0000000..aa398e8
--- /dev/null
+++ b/test/fixedbugs/issue5755.dir/a.go
@@ -0,0 +1,60 @@
+// Copyright 2013 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package a
+
+type I interface {
+	F()
+}
+
+type foo1 []byte
+type foo2 []rune
+type foo3 []uint8
+type foo4 []int32
+type foo5 string
+type foo6 string
+type foo7 string
+type foo8 string
+type foo9 string
+
+func (f foo1) F() { return }
+func (f foo2) F() { return }
+func (f foo3) F() { return }
+func (f foo4) F() { return }
+func (f foo5) F() { return }
+func (f foo6) F() { return }
+func (f foo7) F() { return }
+func (f foo8) F() { return }
+func (f foo9) F() { return }
+
+func Test1(s string) I  { return foo1(s) }
+func Test2(s string) I  { return foo2(s) }
+func Test3(s string) I  { return foo3(s) }
+func Test4(s string) I  { return foo4(s) }
+func Test5(s []byte) I  { return foo5(s) }
+func Test6(s []rune) I  { return foo6(s) }
+func Test7(s []uint8) I { return foo7(s) }
+func Test8(s []int32) I { return foo8(s) }
+func Test9(s int) I     { return foo9(s) }
+
+type bar map[int]int
+
+func (b bar) F() { return }
+
+func TestBar() I { return bar{1: 2} }
+
+type baz int
+
+func IsBaz(x interface{}) bool { _, ok := x.(baz); return ok }
+
+type baz2 int
+
+func IsBaz2(x interface{}) bool {
+	switch x.(type) {
+	case baz2:
+		return true
+	default:
+		return false
+	}
+}
diff --git a/test/fixedbugs/issue5105.dir/b.go b/test/fixedbugs/issue5755.dir/main.go
similarity index 53%
copy from test/fixedbugs/issue5105.dir/b.go
copy to test/fixedbugs/issue5755.dir/main.go
index b12e739..6d515f2 100644
--- a/test/fixedbugs/issue5105.dir/b.go
+++ b/test/fixedbugs/issue5755.dir/main.go
@@ -6,10 +6,18 @@ package main
 
 import "./a"
 
-var B = [2]string{"world", "hello"}
-
 func main() {
-	if a.A[0] != B[1] {
-		panic("bad hello")
-	}
+	a.Test1("frumious")
+	a.Test2("frumious")
+	a.Test3("frumious")
+	a.Test4("frumious")
+
+	a.Test5(nil)
+	a.Test6(nil)
+	a.Test7(nil)
+	a.Test8(nil)
+	a.Test9(0)
+
+	a.TestBar()
+	a.IsBaz(nil)
 }
diff --git a/test/fixedbugs/issue4879.go b/test/fixedbugs/issue5755.go
similarity index 65%
copy from test/fixedbugs/issue4879.go
copy to test/fixedbugs/issue5755.go
index 842c811..fa7ea4d 100644
--- a/test/fixedbugs/issue4879.go
+++ b/test/fixedbugs/issue5755.go
@@ -4,7 +4,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Issue 4879: export data misses the '&' for some
-// composite literals in inlined bodies.
+// Issue 5755: exported data for inlining may miss
+// named types when used in string conversions.
 
 package ignored
diff --git a/test/fixedbugs/issue5809.go b/test/fixedbugs/issue5809.go
new file mode 100644
index 0000000..ca060b5
--- /dev/null
+++ b/test/fixedbugs/issue5809.go
@@ -0,0 +1,27 @@
+// run
+
+// Copyright 2013 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// issue 5809: 6g and 8g attempted to constant propagate indexed LEA
+
+package main
+
+import "fmt"
+
+func main() {
+	const d16 = "0123456789ABCDEF"
+	k := 0x1234
+	var x [4]byte
+	
+	x[0] = d16[k>>12&0xf]
+	x[1] = d16[k>>8&0xf]
+	x[2] = d16[k>>4&0xf]
+	x[3] = d16[k&0xf]
+	
+	if x != [4]byte{'1','2','3','4'} {
+		fmt.Println(x)
+		panic("x != [4]byte{'1','2','3','4'}")
+	}
+}
diff --git a/test/fixedbugs/issue4620.go b/test/fixedbugs/issue5820.go
similarity index 50%
copy from test/fixedbugs/issue4620.go
copy to test/fixedbugs/issue5820.go
index 7b4ebf9..94de06d 100644
--- a/test/fixedbugs/issue4620.go
+++ b/test/fixedbugs/issue5820.go
@@ -4,18 +4,15 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Issue 4620: map indexes are not evaluated before assignment of other elements
+// issue 5820: register clobber when clearfat and 64 bit arithmetic is interleaved.
 
 package main
 
-import "fmt"
-
 func main() {
-	m := map[int]int{0:1}
-	i := 0
-	i, m[i] = 1, 2
-	if m[0] != 2 {
-		fmt.Println(m)
-		panic("m[i] != 2")
+	array := make([][]int, 2)
+	index := uint64(1)
+	array[index] = nil
+	if array[1] != nil {
+		panic("array[1] != nil")
 	}
 }
diff --git a/test/fixedbugs/issue5002.go b/test/fixedbugs/issue5841.go
similarity index 66%
copy from test/fixedbugs/issue5002.go
copy to test/fixedbugs/issue5841.go
index 1e74fa1..cfc4a50 100644
--- a/test/fixedbugs/issue5002.go
+++ b/test/fixedbugs/issue5841.go
@@ -4,13 +4,13 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Issue 5002: 8g produces invalid CMPL $0, $0.
-// Used to fail at link time.
+// Issue 5841: 8g produces invalid CMPL $0, $0.
+// Similar to issue 5002, used to fail at link time.
 
 package main
 
 func main() {
-	var y int64
+	var y int
 	if y%1 == 0 {
 	}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-golang/golang.git



More information about the pkg-golang-commits mailing list