diff options
author | Matthew Dempsky <mdempsky@google.com> | 2021-05-25 15:37:20 -0700 |
---|---|---|
committer | Matthew Dempsky <mdempsky@google.com> | 2021-05-25 15:37:20 -0700 |
commit | 5c1e119d48657d60519ee1d0940d0725c06bf85d (patch) | |
tree | d2c3f7d62c799b06b2fbf7bfb073c8f4b654bbcd /test/fixedbugs | |
parent | 155dc0e541368bbd208bfcf12985f58fb375dd5c (diff) | |
parent | f22ec51debeddc0903096e66bfaf641568bede3b (diff) | |
download | go-5c1e119d48657d60519ee1d0940d0725c06bf85d.tar.gz go-5c1e119d48657d60519ee1d0940d0725c06bf85d.zip |
[dev.typeparams] all: merge master (f22ec51) into dev.typeparams
Merge List:
+ 2021-05-25 f22ec51deb doc: add Go 1.17 release note about inlining functions with closures
+ 2021-05-25 8b462d7567 cmd/go: add a -compat flag to 'go mod tidy'
+ 2021-05-24 c89f1224a5 net: verify results from Lookup* are valid domain names
+ 2021-05-24 08a8fa9c47 misc/wasm: ensure correct stack pointer in catch clauses
+ 2021-05-24 32b73ae180 cmd/go: align checks of module path during initialization.
+ 2021-05-24 15d9d4a009 cmd/go: add tests illustrating what happens when Go 1.16 is used in a Go 1.17 main module
+ 2021-05-24 873401df5b cmd/compile: ensure equal functions don't do unaligned loads
+ 2021-05-24 b83610699a cmd/compile: record regabi status in DW_AT_producer
+ 2021-05-24 a22e317220 cmd/compile: always include underlying type for map types
+ 2021-05-24 4356e7e85f runtime: account for spill slots in Windows callback compilation
+ 2021-05-24 52d7033ff6 cmd/go/internal/modload: set the default GoVersion in a single location
+ 2021-05-24 05819bc104 cmd/go/internal/modcmd: factor out a type for flags whose arguments are Go versions
+ 2021-05-22 cca23a7373 cmd/compile: revert CL/316890
+ 2021-05-21 f87194cbd7 doc/go1.17: document changes to net/http package
+ 2021-05-21 217f5dd496 doc: document additional atomic.Value methods
+ 2021-05-21 3c656445f1 cmd/go: in TestScript/mod_replace, download an explicit module path
+ 2021-05-21 76b2d6afed os: document that StartProcess puts files into blocking mode
+ 2021-05-21 e4d7525c3e cmd/dist: display first class port status in json output
+ 2021-05-21 4fb10b2118 cmd/go: in 'go mod download' without args, don't save module zip sums
+ 2021-05-21 4fda54ce3f doc/go1.17: document database/sql changes for Go 1.17
+ 2021-05-21 8876b9bd6a doc/go1.17: document io/fs changes for Go 1.17
+ 2021-05-21 5fee772c87 doc/go1.17: document archive/zip changes for Go 1.17
+ 2021-05-21 3148694f60 cmd/go: remove warning from module deprecation notice printing
+ 2021-05-21 7e63c8b765 runtime: wait for Go runtime to initialize in Windows signal test
+ 2021-05-21 831573cd21 io/fs: added an example for io/fs.WalkDir
+ 2021-05-20 baa934d26d cmd: go get golang.org/x/tools/analysis@49064d23 && go mod vendor
+ 2021-05-20 7c692cc7ea doc/go1.17: document changes to os package
+ 2021-05-20 ce9a3b79d5 crypto/x509: add new FreeBSD 12.2+ trusted certificate folder
+ 2021-05-20 f8be906d74 test: re-enable test on riscv64 now that it supports external linking
+ 2021-05-20 def5360541 doc/go1.17: add release notes for OpenBSD ports
+ 2021-05-20 ef1f52cc38 doc/go1.17: add release note for windows/arm64 port
+ 2021-05-20 bb7495a46d doc/go1.17: document new math constants
+ 2021-05-20 f07e4dae3c syscall: document NewCallback and NewCallbackCDecl limitations
+ 2021-05-20 a8d85918b6 misc/cgo/testplugin: skip TestIssue25756pie on darwin/arm64 builder
+ 2021-05-19 6c1c055d1e cmd/internal/moddeps: use filepath.SkipDir only on directories
+ 2021-05-19 658b5e66ec net: return nil UDPAddr from ReadFromUDP
+ 2021-05-19 15a374d5c1 test: check portable error message on issue46234.go
+ 2021-05-18 eeadce2d87 go/build/constraint: fix parsing of "// +build" (with no args)
+ 2021-05-18 6d2ef2ef2a cmd/compile: don't emit inltree for closure within body of inlined func
+ 2021-05-18 048cb4ceee crypto/x509: remove duplicate import
Change-Id: Ib0442e3555493805f2aa1df26dfd6898df989a37
Diffstat (limited to 'test/fixedbugs')
-rw-r--r-- | test/fixedbugs/issue10607.go | 5 | ||||
-rw-r--r-- | test/fixedbugs/issue46234.go | 103 | ||||
-rw-r--r-- | test/fixedbugs/issue46304.go | 76 |
3 files changed, 180 insertions, 4 deletions
diff --git a/test/fixedbugs/issue10607.go b/test/fixedbugs/issue10607.go index 448a37dcac..8a04bc9def 100644 --- a/test/fixedbugs/issue10607.go +++ b/test/fixedbugs/issue10607.go @@ -1,4 +1,4 @@ -// +build linux,!ppc64,!riscv64,gc +// +build linux,!ppc64,gc // run // Copyright 2015 The Go Authors. All rights reserved. @@ -8,9 +8,6 @@ // Test that a -B option is passed through when using both internal // and external linking mode. -// TODO(jsing): Re-enable on riscv64 when it has support for external -// linking - see golang.org/issue/36739 - package main import ( diff --git a/test/fixedbugs/issue46234.go b/test/fixedbugs/issue46234.go new file mode 100644 index 0000000000..8e7eb8bf8d --- /dev/null +++ b/test/fixedbugs/issue46234.go @@ -0,0 +1,103 @@ +// buildrun -t 30 + +// +build !js + +// Copyright 2021 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. + +// Ensure that runtime traceback does not infinite loop for +// the testcase below. + +package main + +import ( + "bytes" + "io/ioutil" + "log" + "os" + "os/exec" + "path/filepath" +) + +const prog = ` + +package main + +import "context" + +var gpi *int + +type nAO struct { + eE bool +} + +type NAO func(*nAO) + +func WEA() NAO { + return func(o *nAO) { o.eE = true } +} + +type R struct { + cM *CM +} + +type CM int + +type A string + +func (m *CM) NewA(ctx context.Context, cN string, nn *nAO, opts ...NAO) (*A, error) { + for _, o := range opts { + o(nn) + } + s := A("foo") + return &s, nil +} + +func (r *R) CA(ctx context.Context, cN string, nn *nAO) (*int, error) { + cA, err := r.cM.NewA(ctx, cN, nn, WEA(), WEA()) + if err == nil { + return nil, err + } + println(cA) + x := int(42) + return &x, nil +} + +func main() { + c := CM(1) + r := R{cM: &c} + var ctx context.Context + nnr := nAO{} + pi, err := r.CA(ctx, "foo", nil) + if err != nil { + panic("bad") + } + println(nnr.eE) + gpi = pi +} +` + +func main() { + dir, err := ioutil.TempDir("", "46234") + if err != nil { + log.Fatal(err) + } + defer os.RemoveAll(dir) + + file := filepath.Join(dir, "main.go") + if err := ioutil.WriteFile(file, []byte(prog), 0655); err != nil { + log.Fatalf("Write error %v", err) + } + + cmd := exec.Command("go", "run", file) + output, err := cmd.CombinedOutput() + if err == nil { + log.Fatalf("Passed, expected an error") + } + + want := []byte("nil pointer dereference") + if !bytes.Contains(output, want) { + log.Fatalf("Unmatched error message %q:\nin\n%s\nError: %v", want, output, err) + } +} diff --git a/test/fixedbugs/issue46304.go b/test/fixedbugs/issue46304.go new file mode 100644 index 0000000000..b8ecfc93a5 --- /dev/null +++ b/test/fixedbugs/issue46304.go @@ -0,0 +1,76 @@ +// run + +// Copyright 2021 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. + +// This testcase caused a crash when the register ABI was in effect, +// on amd64 (problem with register allocation). + +package main + +type Op struct { + tag string + _x []string + _q [20]uint64 + plist []P +} + +type P struct { + tag string + _x [10]uint64 + b bool +} + +type M int + +//go:noinline +func (w *M) walkP(p *P) *P { + np := &P{} + *np = *p + np.tag += "new" + return np +} + +func (w *M) walkOp(op *Op) *Op { + if op == nil { + return nil + } + + orig := op + cloned := false + clone := func() { + if !cloned { + cloned = true + op = &Op{} + *op = *orig + } + } + + pCloned := false + for i := range op.plist { + if s := w.walkP(&op.plist[i]); s != &op.plist[i] { + if !pCloned { + pCloned = true + clone() + op.plist = make([]P, len(orig.plist)) + copy(op.plist, orig.plist) + } + op.plist[i] = *s + } + } + + return op +} + +func main() { + var ww M + w := &ww + p1 := P{tag: "a"} + p1._x[1] = 9 + o := Op{tag: "old", plist: []P{p1}} + no := w.walkOp(&o) + if no.plist[0].tag != "anew" { + panic("bad") + } +} |