Skip to content

Commit 118f76c

Browse files
committed
Merge remote-tracking branch 'origin/release-branch.go1.17' into tailscale.go1.17
2 parents 7b34cac + de690c2 commit 118f76c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+634
-218
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
go1.17.3
1+
go1.17.5

misc/cgo/testplugin/plugin_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ func TestIssue25756(t *testing.T) {
265265

266266
// Test with main using -buildmode=pie with plugin for issue #43228
267267
func TestIssue25756pie(t *testing.T) {
268-
if os.Getenv("GO_BUILDER_NAME") == "darwin-arm64-11_0-toothrot" {
268+
if os.Getenv("GO_BUILDER_NAME") == "darwin-arm64-11_0-toothrot" || os.Getenv("GO_BUILDER_NAME") == "darwin-arm64-12_0-toothrot" {
269269
t.Skip("broken on darwin/arm64 builder in sharded mode; see issue 46239")
270270
}
271271

src/cmd/compile/internal/noder/transform.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,11 @@ func transformSelect(sel *ir.SelectStmt) {
495495
if ncase.Comm != nil {
496496
n := ncase.Comm
497497
oselrecv2 := func(dst, recv ir.Node, def bool) {
498-
n := ir.NewAssignListStmt(n.Pos(), ir.OSELRECV2, []ir.Node{dst, ir.BlankNode}, []ir.Node{recv})
499-
n.Def = def
500-
n.SetTypecheck(1)
501-
ncase.Comm = n
498+
selrecv := ir.NewAssignListStmt(n.Pos(), ir.OSELRECV2, []ir.Node{dst, ir.BlankNode}, []ir.Node{recv})
499+
selrecv.Def = def
500+
selrecv.SetTypecheck(1)
501+
selrecv.SetInit(n.Init())
502+
ncase.Comm = selrecv
502503
}
503504
switch n.Op() {
504505
case ir.OAS:

src/cmd/compile/internal/ssa/expand_calls.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -952,6 +952,7 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, source, mem *Value,
952952
return x.storeArgOrLoad(pos, b, source, mem, t, storeOffset, loadRegOffset, storeRc)
953953
}
954954
eltRO := x.regWidth(elt)
955+
source.Type = t
955956
for i := int64(0); i < t.NumElem(); i++ {
956957
sel := source.Block.NewValue1I(pos, OpArraySelect, elt, i, source)
957958
mem = x.storeArgOrLoad(pos, b, sel, mem, elt, storeOffset+i*elt.Width, loadRegOffset, storeRc.at(t, 0))
@@ -985,6 +986,7 @@ func (x *expandState) storeArgOrLoad(pos src.XPos, b *Block, source, mem *Value,
985986
return x.storeArgOrLoad(pos, b, source, mem, t, storeOffset, loadRegOffset, storeRc)
986987
}
987988

989+
source.Type = t
988990
for i := 0; i < t.NumFields(); i++ {
989991
fld := t.Field(i)
990992
sel := source.Block.NewValue1I(pos, OpStructSelect, fld.Type, int64(i), source)

src/cmd/compile/internal/ssa/fuse_branchredirect.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ func fuseBranchRedirect(f *Func) bool {
7878
if v.Op != OpPhi {
7979
continue
8080
}
81-
v.RemoveArg(k)
81+
n := len(v.Args)
82+
v.Args[k].Uses--
83+
v.Args[k] = v.Args[n-1]
84+
v.Args[n-1] = nil
85+
v.Args = v.Args[:n-1]
8286
phielimValue(v)
8387
}
8488
// Fix up child to have one more predecessor.

src/cmd/compile/internal/typecheck/stmt.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,11 @@ func tcSelect(sel *ir.SelectStmt) {
383383
n := Stmt(ncase.Comm)
384384
ncase.Comm = n
385385
oselrecv2 := func(dst, recv ir.Node, def bool) {
386-
n := ir.NewAssignListStmt(n.Pos(), ir.OSELRECV2, []ir.Node{dst, ir.BlankNode}, []ir.Node{recv})
387-
n.Def = def
388-
n.SetTypecheck(1)
389-
ncase.Comm = n
386+
selrecv := ir.NewAssignListStmt(n.Pos(), ir.OSELRECV2, []ir.Node{dst, ir.BlankNode}, []ir.Node{recv})
387+
selrecv.Def = def
388+
selrecv.SetTypecheck(1)
389+
selrecv.SetInit(n.Init())
390+
ncase.Comm = selrecv
390391
}
391392
switch n.Op() {
392393
default:

src/cmd/go/script_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ var extraEnvKeys = []string{
142142
"GO_TESTING_GOTOOLS", // for gccgo testing
143143
"GCCGO", // for gccgo testing
144144
"GCCGOTOOLDIR", // for gccgo testing
145+
"MallocNanoZone", // Needed to work around an apparent kernel bug in macOS 12; see https://golang.org/issue/49138.
145146
}
146147

147148
// setup sets up the test execution temporary directory and environment.

src/cmd/go/testdata/script/mod_get_direct.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ env GO111MODULE=on
1010
env GOPROXY=direct
1111
env GOSUMDB=off
1212

13-
go list -m cloud.google.com/go@master
13+
go list -m cloud.google.com/go@main
1414
! stdout 'v0.0.0-'
1515

1616
-- go.mod --

src/cmd/link/internal/arm64/asm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -602,7 +602,7 @@ func pereloc1(arch *sys.Arch, out *ld.OutBuf, ldr *loader.Loader, s loader.Sym,
602602
rs := r.Xsym
603603
rt := r.Type
604604

605-
if r.Xadd != signext21(r.Xadd) {
605+
if rt == objabi.R_ADDRARM64 && r.Xadd != signext21(r.Xadd) {
606606
// If the relocation target would overflow the addend, then target
607607
// a linker-manufactured label symbol with a smaller addend instead.
608608
label := ldr.Lookup(offsetLabelName(ldr, rs, r.Xadd/peRelocLimit*peRelocLimit), ldr.SymVersion(rs))

src/cmd/link/link_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -993,13 +993,31 @@ package main
993993
994994
var x = [1<<25]byte{1<<23: 23, 1<<24: 24}
995995
996+
var addr = [...]*byte{
997+
&x[1<<23-1],
998+
&x[1<<23],
999+
&x[1<<23+1],
1000+
&x[1<<24-1],
1001+
&x[1<<24],
1002+
&x[1<<24+1],
1003+
}
1004+
9961005
func main() {
1006+
// check relocations in instructions
9971007
check(x[1<<23-1], 0)
9981008
check(x[1<<23], 23)
9991009
check(x[1<<23+1], 0)
10001010
check(x[1<<24-1], 0)
10011011
check(x[1<<24], 24)
10021012
check(x[1<<24+1], 0)
1013+
1014+
// check absolute address relocations in data
1015+
check(*addr[0], 0)
1016+
check(*addr[1], 23)
1017+
check(*addr[2], 0)
1018+
check(*addr[3], 0)
1019+
check(*addr[4], 24)
1020+
check(*addr[5], 0)
10031021
}
10041022
10051023
func check(x, y byte) {

src/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ go 1.17
44

55
require (
66
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e
7-
golang.org/x/net v0.0.0-20211101194204-95aca89e93de
7+
golang.org/x/net v0.0.0-20211209100829-84cba5454caf
88
)
99

1010
require (

src/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e h1:8foAy0aoO5GkqCvAEJ4VC4P3zksTg4X4aJCDpZzmgQI=
22
golang.org/x/crypto v0.0.0-20210503195802-e9a32991a82e/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
33
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
4-
golang.org/x/net v0.0.0-20211101194204-95aca89e93de h1:dKoXPECQZ51dGVSkuiD9YzeNpLT4UPUY4d3xo0sWrkU=
5-
golang.org/x/net v0.0.0-20211101194204-95aca89e93de/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
4+
golang.org/x/net v0.0.0-20211209100829-84cba5454caf h1:Chci/BE/+xVqrcWnObL99NS8gtXyJrhHDlygBQrggHM=
5+
golang.org/x/net v0.0.0-20211209100829-84cba5454caf/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
66
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
77
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
88
golang.org/x/sys v0.0.0-20210511113859-b0526f3d8744 h1:yhBbb4IRs2HS9PPlAg6DMC6mUOKexJBNsLf4Z+6En1Q=

src/go/types/decl.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ func (check *Checker) validType(typ Type, path []Object) typeInfo {
343343
if tn == t.obj {
344344
check.cycleError(path[i:])
345345
t.info = invalid
346+
t.underlying = Typ[Invalid]
346347
return t.info
347348
}
348349
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright 2021 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
package p
6+
7+
import "unsafe"
8+
9+
type T /* ERROR illegal cycle in declaration of T */ struct {
10+
T
11+
}
12+
13+
func _(t T) {
14+
_ = unsafe.Sizeof(t) // should not go into infinite recursion here
15+
}

src/go/types/type.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -759,6 +759,9 @@ func (check *Checker) newTypeParam(obj *TypeName, index int, bound Type) *_TypeP
759759

760760
func (t *_TypeParam) Bound() *Interface {
761761
iface := asInterface(t.bound)
762+
if iface == nil {
763+
return &emptyInterface
764+
}
762765
// use the type bound position if we have one
763766
pos := token.NoPos
764767
if n, _ := t.bound.(*Named); n != nil {

src/net/http/client.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -965,7 +965,6 @@ func (b *cancelTimerBody) Read(p []byte) (n int, err error) {
965965
if err == nil {
966966
return n, nil
967967
}
968-
b.stop()
969968
if err == io.EOF {
970969
return n, err
971970
}

src/net/http/client_test.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,6 +1353,33 @@ func TestClientTimeoutCancel(t *testing.T) {
13531353
}
13541354
}
13551355

1356+
func TestClientTimeoutDoesNotExpire_h1(t *testing.T) { testClientTimeoutDoesNotExpire(t, h1Mode) }
1357+
func TestClientTimeoutDoesNotExpire_h2(t *testing.T) { testClientTimeoutDoesNotExpire(t, h2Mode) }
1358+
1359+
// Issue 49366: if Client.Timeout is set but not hit, no error should be returned.
1360+
func testClientTimeoutDoesNotExpire(t *testing.T, h2 bool) {
1361+
setParallel(t)
1362+
defer afterTest(t)
1363+
1364+
cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
1365+
w.Write([]byte("body"))
1366+
}))
1367+
defer cst.close()
1368+
1369+
cst.c.Timeout = 1 * time.Hour
1370+
req, _ := NewRequest("GET", cst.ts.URL, nil)
1371+
res, err := cst.c.Do(req)
1372+
if err != nil {
1373+
t.Fatal(err)
1374+
}
1375+
if _, err = io.Copy(io.Discard, res.Body); err != nil {
1376+
t.Fatalf("io.Copy(io.Discard, res.Body) = %v, want nil", err)
1377+
}
1378+
if err = res.Body.Close(); err != nil {
1379+
t.Fatalf("res.Body.Close() = %v, want nil", err)
1380+
}
1381+
}
1382+
13561383
func TestClientRedirectEatsBody_h1(t *testing.T) { testClientRedirectEatsBody(t, h1Mode) }
13571384
func TestClientRedirectEatsBody_h2(t *testing.T) { testClientRedirectEatsBody(t, h2Mode) }
13581385
func testClientRedirectEatsBody(t *testing.T, h2 bool) {

src/net/http/clientserver_test.go

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1582,3 +1582,37 @@ func TestH12_WebSocketUpgrade(t *testing.T) {
15821582
},
15831583
}.run(t)
15841584
}
1585+
1586+
func TestIdentityTransferEncoding_h1(t *testing.T) { testIdentityTransferEncoding(t, h1Mode) }
1587+
func TestIdentityTransferEncoding_h2(t *testing.T) { testIdentityTransferEncoding(t, h2Mode) }
1588+
1589+
func testIdentityTransferEncoding(t *testing.T, h2 bool) {
1590+
setParallel(t)
1591+
defer afterTest(t)
1592+
1593+
const body = "body"
1594+
cst := newClientServerTest(t, h2, HandlerFunc(func(w ResponseWriter, r *Request) {
1595+
gotBody, _ := io.ReadAll(r.Body)
1596+
if got, want := string(gotBody), body; got != want {
1597+
t.Errorf("got request body = %q; want %q", got, want)
1598+
}
1599+
w.Header().Set("Transfer-Encoding", "identity")
1600+
w.WriteHeader(StatusOK)
1601+
w.(Flusher).Flush()
1602+
io.WriteString(w, body)
1603+
}))
1604+
defer cst.close()
1605+
req, _ := NewRequest("GET", cst.ts.URL, strings.NewReader(body))
1606+
res, err := cst.c.Do(req)
1607+
if err != nil {
1608+
t.Fatal(err)
1609+
}
1610+
defer res.Body.Close()
1611+
gotBody, err := io.ReadAll(res.Body)
1612+
if err != nil {
1613+
t.Fatal(err)
1614+
}
1615+
if got, want := string(gotBody), body; got != want {
1616+
t.Errorf("got response body = %q; want %q", got, want)
1617+
}
1618+
}

src/net/http/h2_bundle.go

Lines changed: 58 additions & 33 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)