aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorMatthew Dempsky <mdempsky@google.com>2022-07-28 00:32:28 -0700
committerMatthew Dempsky <mdempsky@google.com>2022-07-28 00:32:28 -0700
commit23554d474443ef8f2dacc8c92be5636504df61ac (patch)
tree95cbe8f06385d95b52f018d431ab2d1b6d805c64 /src/cmd
parentc8d5ccf82ec24ff3855c1717d46df6a0c60684de (diff)
parent462b78fe7027ef0d2e2b40c3cfd1f5a37d307310 (diff)
downloadgo-23554d474443ef8f2dacc8c92be5636504df61ac.tar.xz
[dev.unified] all: merge master (462b78f) into dev.unified
Merge List: + 2022-07-27 462b78fe70 misc/cgo/test: use fewer threads in TestSetgidStress in long mode + 2022-07-27 055113ef36 math/big: check buffer lengths in GobDecode + 2022-07-27 4248146154 net: document UDPConn.ReadFromUDPAddrPort's AddrPort result more + 2022-07-26 faf4e97200 net: fix WriteMsgUDPAddrPort addr handling + 2022-07-26 caa225dd29 doc/go1.19: note that updated race syso files require GNU ld 2.26 + 2022-07-26 ceefd3a37b bytes: document that Reader.Reset affects the result of Size + 2022-07-26 3e97294663 runtime/cgo: use frame address to set g0 stack bound + 2022-07-25 24dc27a3c0 cmd/compile: fix blank label code + 2022-07-25 9fcc8b2c1e runtime: fix runtime.Breakpoint() on windows/arm64 + 2022-07-25 795a88d0c3 cmd/go: add space after comma in 'go help test' + 2022-07-25 9eb3992ddd doc/go1.19: minor fixes + 2022-07-25 dcea1ee6e3 time: clarify documentation for allowed formats and add tests to prove them + 2022-07-25 37c8112b82 internal/fuzz: fix typo in function comments + 2022-07-25 850d547d2d doc/go1.19: expand crypto release notes + 2022-07-24 64f2829c9c runtime: fix typo in function comments + 2022-07-24 2ff563a00e cmd/compile/internal/noder: correct spelling errors for instantiation + 2022-07-22 c5da4fb7ac cmd/compile: make jump table symbol local + 2022-07-22 774fa58d1d A+C: delete AUTHORS and CONTRIBUTORS + 2022-07-21 2d655fb15a unsafe: document when Sizeof/Offsetof/Alignof are not constant + 2022-07-21 076c3d7f07 net/http: remove accidental heading in Head documentation + 2022-07-21 c4a6d3048b cmd/dist: enable race detector test on S390X + 2022-07-20 244c8b0500 cmd/cgo: allow cgo to pass strings or []bytes bigger than 1<<30 + 2022-07-20 df38614bd7 test: use go tool from tree, not path + 2022-07-20 bb1749ba3b cmd/compile: improve GOAMD64=v1 violation test + 2022-07-19 176b63e711 crypto/internal/nistec,debug/gosym: fix typos Change-Id: I96e5d60039381691dffd841e58927f0afff8c544
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/cgo/out.go23
-rw-r--r--src/cmd/compile/internal/amd64/versions_test.go31
-rw-r--r--src/cmd/compile/internal/noder/stencil.go2
-rw-r--r--src/cmd/compile/internal/ssa/rewrite.go1
-rw-r--r--src/cmd/compile/internal/ssagen/ssa.go4
-rw-r--r--src/cmd/dist/test.go2
-rw-r--r--src/cmd/go/alldocs.go2
-rw-r--r--src/cmd/go/internal/test/test.go2
8 files changed, 52 insertions, 15 deletions
diff --git a/src/cmd/cgo/out.go b/src/cmd/cgo/out.go
index d6740028da..119eca2be7 100644
--- a/src/cmd/cgo/out.go
+++ b/src/cmd/cgo/out.go
@@ -1653,10 +1653,18 @@ const cStringDef = `
// freed, such as by calling C.free (be sure to include stdlib.h
// if C.free is needed).
func _Cfunc_CString(s string) *_Ctype_char {
+ if len(s)+1 <= 0 {
+ panic("string too large")
+ }
p := _cgo_cmalloc(uint64(len(s)+1))
- pp := (*[1<<30]byte)(p)
- copy(pp[:], s)
- pp[len(s)] = 0
+ sliceHeader := struct {
+ p unsafe.Pointer
+ len int
+ cap int
+ }{p, len(s)+1, len(s)+1}
+ b := *(*[]byte)(unsafe.Pointer(&sliceHeader))
+ copy(b, s)
+ b[len(s)] = 0
return (*_Ctype_char)(p)
}
`
@@ -1670,8 +1678,13 @@ const cBytesDef = `
// if C.free is needed).
func _Cfunc_CBytes(b []byte) unsafe.Pointer {
p := _cgo_cmalloc(uint64(len(b)))
- pp := (*[1<<30]byte)(p)
- copy(pp[:], b)
+ sliceHeader := struct {
+ p unsafe.Pointer
+ len int
+ cap int
+ }{p, len(b), len(b)}
+ s := *(*[]byte)(unsafe.Pointer(&sliceHeader))
+ copy(s, b)
return p
}
`
diff --git a/src/cmd/compile/internal/amd64/versions_test.go b/src/cmd/compile/internal/amd64/versions_test.go
index 2ac6e95c91..b6411a1cb0 100644
--- a/src/cmd/compile/internal/amd64/versions_test.go
+++ b/src/cmd/compile/internal/amd64/versions_test.go
@@ -242,12 +242,31 @@ var featureToOpcodes = map[string][]string{
// go tool objdump doesn't include a [QL] on popcnt instructions, until CL 351889
// native objdump doesn't include [QL] on linux.
"popcnt": {"popcntq", "popcntl", "popcnt"},
- "bmi1": {"andnq", "andnl", "andn", "blsiq", "blsil", "blsi", "blsmskq", "blsmskl", "blsmsk", "blsrq", "blsrl", "blsr", "tzcntq", "tzcntl", "tzcnt"},
- "bmi2": {"sarxq", "sarxl", "sarx", "shlxq", "shlxl", "shlx", "shrxq", "shrxl", "shrx"},
- "sse41": {"roundsd"},
- "fma": {"vfmadd231sd"},
- "movbe": {"movbeqq", "movbeq", "movbell", "movbel", "movbe"},
- "lzcnt": {"lzcntq", "lzcntl", "lzcnt"},
+ "bmi1": {
+ "andnq", "andnl", "andn",
+ "blsiq", "blsil", "blsi",
+ "blsmskq", "blsmskl", "blsmsk",
+ "blsrq", "blsrl", "blsr",
+ "tzcntq", "tzcntl", "tzcnt",
+ },
+ "bmi2": {
+ "sarxq", "sarxl", "sarx",
+ "shlxq", "shlxl", "shlx",
+ "shrxq", "shrxl", "shrx",
+ },
+ "sse41": {
+ "roundsd",
+ "pinsrq", "pinsrl", "pinsrd", "pinsrb", "pinsr",
+ "pextrq", "pextrl", "pextrd", "pextrb", "pextr",
+ "pminsb", "pminsd", "pminuw", "pminud", // Note: ub and sw are ok.
+ "pmaxsb", "pmaxsd", "pmaxuw", "pmaxud",
+ "pmovzxbw", "pmovzxbd", "pmovzxbq", "pmovzxwd", "pmovzxwq", "pmovzxdq",
+ "pmovsxbw", "pmovsxbd", "pmovsxbq", "pmovsxwd", "pmovsxwq", "pmovsxdq",
+ "pblendvb",
+ },
+ "fma": {"vfmadd231sd"},
+ "movbe": {"movbeqq", "movbeq", "movbell", "movbel", "movbe"},
+ "lzcnt": {"lzcntq", "lzcntl", "lzcnt"},
}
// Test to use POPCNT instruction, if available
diff --git a/src/cmd/compile/internal/noder/stencil.go b/src/cmd/compile/internal/noder/stencil.go
index 1ba561b8b9..280f7cdf1c 100644
--- a/src/cmd/compile/internal/noder/stencil.go
+++ b/src/cmd/compile/internal/noder/stencil.go
@@ -623,7 +623,7 @@ func checkFetchBody(nameNode *ir.Name) {
}
}
-// getInstantiation gets the instantiantion and dictionary of the function or method nameNode
+// getInstantiation gets the instantiation and dictionary of the function or method nameNode
// with the type arguments shapes. If the instantiated function is not already
// cached, then it calls genericSubst to create the new instantiation.
func (g *genInst) getInstantiation(nameNode *ir.Name, shapes []*types.Type, isMeth bool) *instInfo {
diff --git a/src/cmd/compile/internal/ssa/rewrite.go b/src/cmd/compile/internal/ssa/rewrite.go
index d41772ad8a..05fb2f2776 100644
--- a/src/cmd/compile/internal/ssa/rewrite.go
+++ b/src/cmd/compile/internal/ssa/rewrite.go
@@ -1959,5 +1959,6 @@ func logicFlags32(x int32) flagConstant {
func makeJumpTableSym(b *Block) *obj.LSym {
s := base.Ctxt.Lookup(fmt.Sprintf("%s.jump%d", b.Func.fe.LSym(), b.ID))
s.Set(obj.AttrDuplicateOK, true)
+ s.Set(obj.AttrLocal, true)
return s
}
diff --git a/src/cmd/compile/internal/ssagen/ssa.go b/src/cmd/compile/internal/ssagen/ssa.go
index 64a30d427f..1e5313f95e 100644
--- a/src/cmd/compile/internal/ssagen/ssa.go
+++ b/src/cmd/compile/internal/ssagen/ssa.go
@@ -1507,6 +1507,10 @@ func (s *state) stmt(n ir.Node) {
case ir.OLABEL:
n := n.(*ir.LabelStmt)
sym := n.Label
+ if sym.IsBlank() {
+ // Nothing to do because the label isn't targetable. See issue 52278.
+ break
+ }
lab := s.label(sym)
// The label might already have a target block via a goto.
diff --git a/src/cmd/dist/test.go b/src/cmd/dist/test.go
index 846d0c0d85..976e8346ba 100644
--- a/src/cmd/dist/test.go
+++ b/src/cmd/dist/test.go
@@ -1720,7 +1720,7 @@ func (t *tester) runPrecompiledStdTest(timeout time.Duration) error {
func raceDetectorSupported(goos, goarch string) bool {
switch goos {
case "linux":
- return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64"
+ return goarch == "amd64" || goarch == "ppc64le" || goarch == "arm64" || goarch == "s390x"
case "darwin":
return goarch == "amd64" || goarch == "arm64"
case "freebsd", "netbsd", "openbsd", "windows":
diff --git a/src/cmd/go/alldocs.go b/src/cmd/go/alldocs.go
index db6372642a..a3c1fecb91 100644
--- a/src/cmd/go/alldocs.go
+++ b/src/cmd/go/alldocs.go
@@ -1708,7 +1708,7 @@
// the package's source root (usually $GOPATH) or that consult environment
// variables only match future runs in which the files and environment
// variables are unchanged. A cached test result is treated as executing
-// in no time at all,so a successful package test result will be cached and
+// in no time at all, so a successful package test result will be cached and
// reused regardless of -timeout setting.
//
// In addition to the build flags, the flags handled by 'go test' itself are:
diff --git a/src/cmd/go/internal/test/test.go b/src/cmd/go/internal/test/test.go
index 058906d9b8..aa5e41e004 100644
--- a/src/cmd/go/internal/test/test.go
+++ b/src/cmd/go/internal/test/test.go
@@ -132,7 +132,7 @@ test caching explicitly is to use -count=1. Tests that open files within
the package's source root (usually $GOPATH) or that consult environment
variables only match future runs in which the files and environment
variables are unchanged. A cached test result is treated as executing
-in no time at all,so a successful package test result will be cached and
+in no time at all, so a successful package test result will be cached and
reused regardless of -timeout setting.
In addition to the build flags, the flags handled by 'go test' itself are: