aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-01-07[release-branch.go1.11] cmd/go: respect gcflags, ldflags in 'go test'Alessandro Arzilli
Fixes bug introduced by https://golang.org/cl/129059 where gcflags='all=...' and ldflags='all=...' would not be applied to some packages built by 'go test'. LoadImport used to set gcflags/ldflags for the Package objects it created, in https://golang.org/cl/129059 this code was factored out to setToolFlags. The codepath of `go build` was updated to call setToolFlags appropriatley, but the codepath of `go test -c` wasn't, resulting in gcflags/ldflags being applied inconsistently when building tests. This commit changes TestPackagesFor to call setToolFlags on the package objects it creates. Fixes #28346 Change-Id: Idcbec0c989ee96ec066207184611f08818873e8d Reviewed-on: https://go-review.googlesource.com/c/136275 Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from commit 374546d800124e9ab4d51b75e335a71f866f3ef8) Reviewed-on: https://go-review.googlesource.com/c/156377 Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
2019-01-04[release-branch.go1.11] runtime: don't scan go'd function args past length ↵Keith Randall
of ptr bitmap Use the length of the bitmap to decide how much to pass to the write barrier, not the total length of the arguments. The test needs enough arguments so that two distinct bitmaps get interpreted as a single longer bitmap. Fixes #29565 Change-Id: I78f3f7f9ec89c2ad4678f0c52d3d3def9cac8e72 Reviewed-on: https://go-review.googlesource.com/c/156123 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> Reviewed-on: https://go-review.googlesource.com/c/156359 Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-04[release-branch.go1.11] runtime: add test for go function argument scanningKeith Randall
Derived from Naoki's reproducer. Update #29565 Change-Id: I1cbd33b38a2f74905dbc22c5ecbad4a87a24bdd1 Reviewed-on: https://go-review.googlesource.com/c/156122 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit af4320350b3a156de0d1cfa9845ab1e48dcbfefa) Reviewed-on: https://go-review.googlesource.com/c/156358 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-04[release-branch.go1.11] runtime: skip stack barrier copy when there are no ↵Inada Naoki
pointers After CL 31455, "go fun(n)" may put "n" to write barrier buffer when there are no pointers in fun's arguments. Updates #29565 Change-Id: Icfa42b8759ce8ad9267dcb3859c626feb6fda381 Reviewed-on: https://go-review.googlesource.com/c/155779 Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 5372257e600989ab4cf742b35e3fa649cad3f45c) Reviewed-on: https://go-review.googlesource.com/c/156357 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2019-01-04[release-branch.go1.11] cmd/compile: fix MIPS SGTconst-with-shift rulesCherry Zhang
(SGTconst [c] (SRLconst _ [d])) && 0 <= int32(c) && uint32(d) <= 31 && 1<<(32-uint32(d)) <= int32(c) -> (MOVWconst [1]) This rule is problematic. 1<<(32-uint32(d)) <= int32(c) meant to say that it is true if c is greater than the largest possible value of the right shift. But when d==1, 1<<(32-1) is negative and results in the wrong comparison. Rewrite the rules in a more direct way. Updates #29402. Fixes #29442. Change-Id: I5940fc9538d9bc3a4bcae8aa34672867540dc60e Reviewed-on: https://go-review.googlesource.com/c/155798 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 6a64efc25004175e198e75191e215a7b1a08a2fa) Reviewed-on: https://go-review.googlesource.com/c/155799 Reviewed-by: David Chase <drchase@google.com>
2019-01-03[release-branch.go1.11] encoding/json: recover saved error context when ↵Ian Davis
unmarshalling Fixes #29364 Change-Id: I270c56fd0d5ae8787a1293029aff3072f4f52f33 Reviewed-on: https://go-review.googlesource.com/132955 Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Run-TryBot: Daniel Martí <mvdan@mvdan.cc> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit 22afb3571c4bb6268664ecc5da4416ec58d3e060) Reviewed-on: https://go-review.googlesource.com/c/155377 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
2018-12-19[release-branch.go1.11] runtime: don't clear lockedExt on locked M when G exitsMichael Anthony Knyszek
When a locked M has its G exit without calling UnlockOSThread, then lockedExt on it was getting cleared. Unfortunately, this meant that during P handoff, if a new M was started, it might get forked (on most OSes besides Windows) from the locked M, which could have kernel state attached to it. To solve this, just don't clear lockedExt. At the point where the locked M has its G exit, it will also exit in accordance with the LockOSThread API. So, we can safely assume that it's lockedExt state will no longer be used. For the case of the main thread where it just gets wedged instead of exiting, it's probably better for it to keep the locked marker since it more accurately represents its state. Fixed #28986. Change-Id: I7d3d71dd65bcb873e9758086d2cbcb9a06429b0f Reviewed-on: https://go-review.googlesource.com/c/155117 Run-TryBot: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-17[release-branch.go1.11] cmd/compile: generate interface method expression ↵Robert Griesemer
wrapper for error.Error A prior optimization (https://golang.org/cl/106175) removed the generation of unnecessary method expression wrappers, but also eliminated the generation of the wrapper for error.Error which was still required. Special-case error type in the optimization. Fixes #29307 Change-Id: I54c8afc88a2c6d1906afa2d09c68a0a3f3e2f1e3 Reviewed-on: https://go-review.googlesource.com/c/154578 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit a1aafd8b28ada0d40e2cb25fb0762ae171eec558) Reviewed-on: https://go-review.googlesource.com/c/154579 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2018-12-14[dev.boringcrypto.go1.11] all: merge go1.11.4 into dev.boringcrypto.go1.11Filippo Valsorda
Change-Id: I313dfbed32bd65bf400e234b608fcd0efaec7469
2018-12-14[release-branch.go1.11] go1.11.4go1.11.4Filippo Valsorda
Change-Id: Id4fe02a5b26da92e99d9817ecbf518682c4345b2 Reviewed-on: https://go-review.googlesource.com/c/154307 Run-TryBot: Filippo Valsorda <filippo@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-12-14[release-branch.go1.11] doc: document Go 1.11.4Filippo Valsorda
Change-Id: Ic098bd69fa9e3f7b2ed6c451a7a266167c0cde94 Reviewed-on: https://go-review.googlesource.com/c/154302 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> (cherry picked from commit 47713567d9ec3784688d4e41ae16dca8466dcb84) Reviewed-on: https://go-review.googlesource.com/c/154306
2018-12-14[release-branch.go1.11] doc: document Go 1.10.7Filippo Valsorda
Change-Id: Id71aad4cf6149e0ba15f7fec0b74517827c37866 Reviewed-on: https://go-review.googlesource.com/c/154303 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> (cherry picked from commit 84bf9ce1fbe7ae8424031550d9cf3fe6b27575e3) Reviewed-on: https://go-review.googlesource.com/c/154304
2018-12-14[release-branch.go1.11] net/http: update bundled x/net/http2Dmitri Shuralyov
This updates x/net/http2 to x/net on the latest commit of x/net on release-branch.go1.11 branch, golang/net@a4630153038d3cb8c57f, for: [release-branch.go1.11] http2: don't leak streams on broken body https://golang.org/cl/154237 Fixes #28673 Change-Id: I8f40c69502fa95d1d9dff1ab68444640444442aa Reviewed-on: https://go-review.googlesource.com/c/154298 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-12-14[release-branch.go1.11] cmd/cgo: don't cache bad pointer typedefsIan Lance Taylor
The set of bad pointer typedefs changes as we see more typedefs, so avoid looking in the cache when we find one. Updates #29175 Fixes #29272 Change-Id: Idd82289bdd8628d11a983fa5ec96517e3a5bcbf1 Reviewed-on: https://go-review.googlesource.com/c/153597 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit 01e072db5d26c224dfbe7763a5b94ab23c163983) Reviewed-on: https://go-review.googlesource.com/c/154299 Run-TryBot: Filippo Valsorda <filippo@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-14[release-branch.go1.11] cmd/compile: use correct store types in softfloatCherry Zhang
When using softfloat, floating point ops are rewritten to integer ops. The types of store ops were not rewritten. This may lower to floating point stores, which are problematic. This CL fixes this by rewriting the store types as well. This fixes test/fixedbugs/issue28688.go on Wasm. Softfloat mode is not used by default on Wasm, and it is not needed as Wasm spec supports floating points. But it is nice to have the correct types. Change-Id: Ib5e19e19fa9491b15c2f60320f8724cace5cefb5 Reviewed-on: https://go-review.googlesource.com/c/149965 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 63a3993a336714f95400e3e614064d4ae72995de) Reviewed-on: https://go-review.googlesource.com/c/151344 Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-12-14[release-branch.go1.11] cmd/cgo: preserve type information across loadDWARF loopIan Lance Taylor
CL 122575 and its successors introduced a loop calling loadDWARF, whereas before we only called it once. Pass a single typeConv to each call, rather than creating a new one in loadDWARF itself. Change the maps from dwarf.Type to use string keys rather than dwarf.Type keys, since when the DWARF is reloaded the dwarf.Type pointers will be different. These changes permit typeConv.Type to return a consistent value for a given DWARF type, avoiding spurious type conversion errors due to typedefs loaded after the first loop iteration. Updates #27340 Fixes #27395 Change-Id: Ic33467bbfca4c54e95909621b35ba2a58216d96e Reviewed-on: https://go-review.googlesource.com/c/152762 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> (cherry picked from commit 6d4358705301e06e71b99977b77ae2c0a6b16b86) Reviewed-on: https://go-review.googlesource.com/c/154277 Run-TryBot: Filippo Valsorda <filippo@golang.org>
2018-12-14[release-branch.go1.11] doc/go1.11: add note about go run supporting for go ↵komuW
run pkg or go run . Fixes golang/go#27047 Change-Id: I0dd40201fc03e87fbc674b47bdf9315f1783d6c2 GitHub-Last-Rev: f28ab6234ade814c4bc09e26417c424c843ad57b GitHub-Pull-Request: golang/go#27048 Reviewed-on: https://go-review.googlesource.com/c/129696 Reviewed-by: komu wairagu <komuw05@gmail.com> Reviewed-by: Andrew Bonventre <andybons@golang.org> (cherry picked from commit 352f1b77c40e2f2c0711244481e1cc25ae423830) Reviewed-on: https://go-review.googlesource.com/c/152744 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-12-14[release-branch.go1.11] cmd/compile: check for negative upper bound to ↵David Chase
IsSliceInBounds IsSliceInBounds(x, y) asserts that y is not negative, but there were cases where this is not true. Change code generation to ensure that this is true when it's not obviously true. Prove phase cleans a few of these out. With this change the compiler text section is 0.06% larger, that is, not very much. Benchmarking still TBD, may need to wait for access to a benchmarking box (next week). Also corrected run.go to handle '?' in -update_errors output. Fixes #28799. Change-Id: Ia8af90bc50a91ae6e934ef973def8d3f398fac7b Reviewed-on: https://go-review.googlesource.com/c/152477 Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit ea6259d5e9d57f247b7d877d4d04602b74ae5155) Reviewed-on: https://go-review.googlesource.com/c/153638
2018-12-14[release-branch.go1.11] cmd/go/internal/modfetch: skip symlinks in ↵Bryan C. Mills
(*coderepo).Zip Tested manually. Before: $ go mod init golang.org/issue/scratch go: creating new go.mod: module golang.org/issue/scratch $ go1.11.2 mod download github.com/rogpeppe/test2@latest go: finding github.com/rogpeppe/test2 v0.0.11 $ find $GOPATH -name goodbye /tmp/tmp.Y8a8UzX3zD/_gopath/pkg/mod/github.com/rogpeppe/test2@v0.0.11/tests/goodbye $ cat $(find $GOPATH -name goodbye) hello After: $ go mod init golang.org/issue/scratch go: creating new go.mod: module golang.org/issue/scratch $ go mod download github.com/rogpeppe/test2@latest go: finding github.com/rogpeppe/test2 v0.0.11 $ find $GOPATH -name goodbye $ find $GOPATH -name hello /tmp/tmp.Zo0jhfLaRs/_gopath/pkg/mod/github.com/rogpeppe/test2@v0.0.11/tests/hello A proper regression test would require one of: • a new entry in the vcs-test server (feasible but tedious, and not easily updated by open-source contributors), or • a way to set up an HTTPS proxy in a script_test, or • a way to explicitly populate the module cache from the contents of a local repository (#28835). Fixes #29191 Updates #28835 Change-Id: I72702a7e791f8815965f0f87c82a30df4d6f0151 Reviewed-on: https://go-review.googlesource.com/c/153819 Run-TryBot: Bryan C. Mills <bcmills@google.com> Reviewed-by: Jay Conrod <jayconrod@google.com> (cherry picked from commit 561923fa7a7d47bba99556aaa61e40dd38708773) Reviewed-on: https://go-review.googlesource.com/c/153822
2018-12-14[release-branch.go1.11] cmd/go/internal/get: move wildcard-trimming to ↵Bryan C. Mills
before CheckImportPath Previously, RepoRootForImportPath trimmed certain "..." wildcards from package patterns (even though its name suggests that the argument must be an actual import path). It trimmed at the first path element that was literally "..." (although wildcards in general may appear within a larger path element), and relied on a subsequent check in RepoRootForImportPath to catch confusing resolutions. However, that causes 'go get' with wildcard patterns in fresh paths to fail as of CL 154101: a wildcard pattern is not a valid import path, and fails the path check. (The existing Test{Vendor,Go}Get* packages in go_test.go and vendor_test.go catch the failure, but they are all skipped when the "-short" flag is set — including in all.bash — and we had forgotten to run them separately.) We now trim the path before any element that contains a wildcard, and perform the path check (and repo resolution) on only that prefix. It is possible that the expanded path after fetching the repo will be invalid, but a repository can contain directories that are not valid import paths in general anyway. Fixes #29248 Change-Id: I70fb2f7fc6603b7d339fd6c02e8cdeacfc93fc4b Reviewed-on: https://go-review.googlesource.com/c/154108 Reviewed-by: Russ Cox <rsc@golang.org> (cherry picked from commit 47fb1fbd554a76dc961bfdedaa85efcb68646ed1) Reviewed-on: https://go-review.googlesource.com/c/154110 Reviewed-by: Filippo Valsorda <filippo@golang.org>
2018-12-13[release-branch.go1.11] all: merge release-branch.go1.11-security into ↵Dmitri Shuralyov
release-branch.go1.11 Change-Id: I2aa2c7056a719f911f68a1710b3c0578a7f595b6
2018-12-13[release-branch.go1.11-security] go1.11.3go1.11.3Dmitri Shuralyov
Change-Id: I0933c8d2f635e987db1a36030ef330f77b5ef8a8 Reviewed-on: https://team-review.git.corp.google.com/c/377323 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-13[release-branch.go1.11-security] cmd/go: set user and email in test-local ↵Bryan C. Mills
git repos Some of the builders cannot infer user and email from the builder hostname. Change-Id: I6f343ae41ca7d984797e595867c8210b404b782f Reviewed-on: https://team-review.git.corp.google.com/c/376740 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-12[release-branch.go1.11-security] doc: document Go 1.11.3 and Go 1.10.6Dmitri Shuralyov
Change-Id: I3fe44887a84586d73be01df78a9cbb002c1fc9c5 Reviewed-on: https://team-review.git.corp.google.com/c/376466 Reviewed-by: Filippo Valsorda <valsorda@google.com>
2018-12-07[release-branch.go1.11-security] cmd/go/internal/get: relax pathOK check to ↵Bryan C. Mills
allow any letter This fixes a regression of #18660 with the new path checks. Change-Id: I2dd9adab999e7f810e0e746ad8b75ea9622f56e7 Reviewed-on: https://team-review.git.corp.google.com/c/372706 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07[release-branch.go1.11-security] cmd/go/internal/get: use a strings.Replacer ↵Bryan C. Mills
in expand This should be a no-op, but produces deterministic (and more correct) behavior if we have accidentally failed to sanitize one of the inputs. Change-Id: I1271d0ffd01a691ec8c84906c4e02d9e2be19c72 Reviewed-on: https://team-review.git.corp.google.com/c/372705 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07[release-branch.go1.11-security] cmd/go/internal/get: reject Windows ↵Bryan C. Mills
shortnames as path components Change-Id: Ia32d8ec1fc0c4e242f50d8871c0ef3ce315f3c65 Reviewed-on: https://team-review.git.corp.google.com/c/370572 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07[release-branch.go1.11-security] cmd/go: reject 'get' of paths containing ↵Bryan C. Mills
leading dots or unsupported characters On some platforms, directories beginning with dot are treated as hidden files, and filenames containing unusual characters can be confusing for users to manipulate (and delete). Change-Id: Ia1f5a65b9cff4eeb51cc4dba3ff7c7afabc343f2 Reviewed-on: https://team-review.git.corp.google.com/c/368442 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-07[release-branch.go1.11-security] crypto/x509: limit number of signature ↵Filippo Valsorda
checks for each verification That number grows quadratically with the number of intermediate certificates in certain pathological cases (for example if they all have the same Subject) leading to a CPU DoS. Set a fixed budget that should fit all real world chains, given we only look at intermediates provided by the peer. The algorithm can be improved, but that's left for follow-up CLs: * the cache logic should be reviewed for correctness, as it seems to override the entire chain with the cached one * the equality check should compare Subject and public key, not the whole certificate * certificates with the right SKID but the wrong Subject should not be considered, and in particular should not take priority over certificates with the right Subject Change-Id: Ib257c12cd5563df7723f9c81231d82b882854213 Reviewed-on: https://team-review.git.corp.google.com/c/370475 Reviewed-by: Andrew Bonventre <andybons@google.com> (cherry picked from commit 09d57361bc99cbbfb9755ee30ddcb42ff5a9d7d6) Reviewed-on: https://team-review.git.corp.google.com/c/372858 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2018-12-05[release-branch.go1.11] cmd/link: close input files when copying to ↵Ian Lance Taylor
temporary directory Updates #29110 Fixes #29112 Change-Id: I077d1a9caa7f4545de1418cec718c4a37ac36ef8 Reviewed-on: https://go-review.googlesource.com/c/152757 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 35435b27c406cdbe506a2eef56c6a10f208e3b9c) Reviewed-on: https://go-review.googlesource.com/c/152760
2018-12-03[dev.boringcrypto.go1.11] all: merge go1.11.2 into dev.boringcrypto.go1.11Filippo Valsorda
Change-Id: I05b1fd8b4d3354935b44fc8fce6ae86dd652c94b
2018-12-03[release-branch.go1.11] cmd/go: don't fail if requested Go version is later ↵Ian Lance Taylor
than current one This is a partial backport of CL 147278 from tip to the Go 1.11 branch. Change the behavior when the go.mod file requests a Go version that is later than the current one. Previously cmd/go would give a fatal error in this situation. With this change it attempts the compilation, and if (and only if) the compilation fails it adds a note saying that the requested Go version is newer than the known version. This is as described in https://golang.org/issue/28221. Updates #28221 Change-Id: Iea03ca574b6b1a046655f2bb2e554126f877fb66 Reviewed-on: https://go-review.googlesource.com/c/151358 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com>
2018-12-03[release-branch.go1.11] cmd/cgo: use field alignment when setting field offsetIan Lance Taylor
The old code ignored the field alignment, and only looked at the field offset: if the field offset required padding, cgo added padding. But while that approach works for Go (at least with the gc toolchain) it doesn't work for C code using packed structs. With a packed struct the added padding may leave the struct at a misaligned position, and the inserted alignment, which cgo is not considering, may introduce additional, unexpected, padding. Padding that ignores alignment is not a good idea when the struct is not packed, and Go structs are never packed. So don't ignore alignment. Updates #28896 Fixes #28916 Change-Id: Ie50ea15fa6dc35557497097be9fecfecb11efd8a Reviewed-on: https://go-review.googlesource.com/c/150602 Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit fbdaa965634be842647195ee2d610dc363c760d2) Reviewed-on: https://go-review.googlesource.com/c/151778 TryBot-Result: Gobot Gobot <gobot@golang.org>
2018-11-27[release-branch.go1.11] go/types: avoid certain problems with recursive ↵Robert Griesemer
alias type declarations It is possible to create certain recursive type declarations involving alias types which cause the type-checker to produce an (invalid) type for the alias because it is not yet available. By type-checking alias declarations in a 2nd phase, the problem is mitigated a bit since it requires more convoluted alias declarations for the problem to appear. Also re-enable testing of fixedbugs/issue27232.go again (which was the original cause for this change). Updates #28576. Fixes #28972. Change-Id: If6f9656a95262e6575b01c4a003094d41551564b Reviewed-on: https://go-review.googlesource.com/c/147597 Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-on: https://go-review.googlesource.com/c/151500 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-11-27[release-branch.go1.11] cmd/compile/internal/gc: OMUL should be evaluated ↵Milan Knezevic
when using soft-float When using soft-float, OMUL might be rewritten to function call so we should ensure it was evaluated first. Updates #28688 Fixes #28694 Change-Id: I30b87501782fff62d35151f394a1c22b0d490c6c Reviewed-on: https://go-review.googlesource.com/c/148837 Run-TryBot: Cherry Zhang <cherryyz@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Cherry Zhang <cherryyz@google.com> (cherry picked from commit c92e73b70253f5d88c473a7ad6c5b8d61b2debb7) Reviewed-on: https://go-review.googlesource.com/c/151342 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-11-26[release-branch.go1.11] cmd/compile: reintroduce work-around for cyclic ↵Robert Griesemer
alias declarations This change re-introduces (temporarily) a work-around for recursive alias type declarations, originally in https://golang.org/cl/35831/ (intended as fix for #18640). The work-around was removed later for a more comprehensive cycle detection check. That check contained a subtle error which made the code appear to work, while in fact creating incorrect types internally. See #25838 for details. By re-introducing the original work-around, we eliminate problems with many simple recursive type declarations involving aliases; specifically cases such as #27232 and #27267. However, the more general problem remains. This CL also fixes the subtle error (incorrect variable use when analyzing a type cycle) mentioned above and now issues a fatal error with a reference to the relevant issue (rather than crashing later during the compilation). While not great, this is better than the current status. The long-term solution will need to address these cycles (see #25838). As a consequence, several old test cases are not accepted anymore by the compiler since they happened to work accidentally only. This CL disables parts or all code of those test cases. The issues are: #18640, #23823, and #24939. One of the new test cases (fixedbugs/issue27232.go) exposed a go/types issue. The test case is excluded from the go/types test suite and an issue was filed (#28576). Updates #18640. Updates #23823. Updates #24939. Updates #25838. Updates #28576. Fixes #27232. Fixes #27267. Fixes #27383. Change-Id: I6c2d10da98bfc6f4f445c755fcaab17fc7b214c5 Reviewed-on: https://go-review.googlesource.com/c/147286 Reviewed-by: Matthew Dempsky <mdempsky@google.com> (cherry picked from commit e6305380a067c51223a59baf8a77575595a5f1e6) Reviewed-on: https://go-review.googlesource.com/c/151339 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2018-11-26runtime: when using explicit argmap, also use arglenKeith Randall
When we set an explicit argmap, we may want only a prefix of that argmap. Argmap is set when the function is reflect.makeFuncStub or reflect.methodValueCall. In this case, arglen specifies how much of the args section is actually live. (It could be either all the args + results, or just the args.) Fixes #28752 Change-Id: Idf060607f15a298ac591016994e58e22f7f92d83 Reviewed-on: https://go-review.googlesource.com/c/149217 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Austin Clements <austin@google.com> (cherry picked from commit 0098f8aeaceb5feec7462ae64f8ce91a473360c1) Reviewed-on: https://go-review.googlesource.com/c/149457
2018-11-21[release-branch.go1.11] cmd/compile: don't deadcode eliminate labelsKeith Randall
Dead-code eliminating labels is tricky because there might be gotos that can still reach them. Bug probably introduced with CL 91056 Fixes #28617 Change-Id: I6680465134e3486dcb658896f5172606cc51b104 Reviewed-on: https://go-review.googlesource.com/c/147817 Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Iskander Sharipov <iskander.sharipov@intel.com> Reviewed-on: https://go-review.googlesource.com/c/147857
2018-11-14[release-branch.go1.11] cmd/go: don't panic when go run is passed ... under ↵Mark Rushakoff
nonexistent dir Given a nonexistent directory above a wildcard: go run ./nonexistent/... Print this error instead of panicking: go run: no packages loaded from ./nonexistent/... Updates #28696. Fixes #28725 Change-Id: Iaa3bc5c78b14ef858d931778e1bc55ca626c5571 GitHub-Last-Rev: bb1a80483ad26c8cf646cf0900d08cfe49aba535 GitHub-Pull-Request: golang/go#28703 Reviewed-on: https://go-review.googlesource.com/c/148821 Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Bryan C. Mills <bcmills@google.com> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com> (cherry picked from commit 529ea7c0de1f9e582280c73031ae870f868e7908) Reviewed-on: https://go-review.googlesource.com/c/149607 Run-TryBot: Ian Lance Taylor <iant@golang.org>
2018-11-14[release-branch.go1.11] runtime: avoid arm64 8.1 atomics on AndroidElias Naur
The kernel on some Samsung S9+ models reports support for arm64 8.1 atomics, but in reality only some of the cores support them. Go programs scheduled to cores without support will crash with SIGILL. This change unconditionally disables the optimization on Android. A better fix is to precisely detect the offending chipset. Fixes #28586 Change-Id: I35a1273e5660603824d30ebef2ce7e429241bf1f Reviewed-on: https://go-review.googlesource.com/c/147377 Run-TryBot: Elias Naur <elias.naur@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-on: https://go-review.googlesource.com/c/149557 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-12[release-branch.go1.11] runtime: never call into race detector with retaken PNikhil Benesch
cgocall could previously invoke the race detector on an M whose P had been retaken. The race detector would attempt to use the P-local state from this stale P, racing with the thread that was actually wired to that P. The result was memory corruption of ThreadSanitizer's internal data structures that presented as hard-to-understand assertion failures and segfaults. Reorder cgocall so that it always acquires a P before invoking the race detector, and add a test that stresses the interaction between cgo and the race detector to protect against future bugs of this kind. Fixes #28690. Change-Id: Ide93f96a23490314d6647547140e0a412a97f0d4 Reviewed-on: https://go-review.googlesource.com/c/148717 Run-TryBot: Dmitry Vyukov <dvyukov@google.com> Reviewed-by: Dmitry Vyukov <dvyukov@google.com> (cherry picked from commit e496e612b7f45a09209f8f4e1c7c1d0db378dc18) Reviewed-on: https://go-review.googlesource.com/c/148902 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2018-11-02[release-branch.go1.11] go1.11.2go1.11.2Andrew Bonventre
Change-Id: Idd3527ba8f2329876cbca646aacd97739b9828f7 Reviewed-on: https://go-review.googlesource.com/c/147217 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-11-02[release-branch.go1.11] doc: document Go 1.11.2Andrew Bonventre
Change-Id: Iaff03911f1807d462f1966590626bd486807f53d Reviewed-on: https://go-review.googlesource.com/c/147178 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit c5d78f512ae6e3867266cfd1cf4cf2194388cbfb) Reviewed-on: https://go-review.googlesource.com/c/147182 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-11-02[release-branch.go1.11] doc: document Go 1.10.5Andrew Bonventre
Change-Id: I11adca150ab795607b832fb354a3e065655e1020 Reviewed-on: https://go-review.googlesource.com/c/147179 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 2764d5ee7b23ae1caf2a4cd4506116a1b9efbf66) Reviewed-on: https://go-review.googlesource.com/c/147181 Reviewed-by: Andrew Bonventre <andybons@golang.org>
2018-11-01[release-branch.go1.11] go/types: use correct receiver types for embedded ↵Robert Griesemer
interface methods Interface methods don't declare a receiver (it's implicit), but after type-checking the respective *types.Func objects are marked as methods by having a receiver. For interface methods, the receiver base type used to be the interface that declared the method in the first place, even if the method also appeared in other interfaces via embedding. A change in the computation of method sets for interfaces for Go1.10 changed that inadvertently, with the consequence that sometimes a method's receiver type ended up being an interface into which the method was embedded. The exact behavior also depended on file type-checking order, and because files are sometimes sorted by name, the behavior depended on file names. This didn't matter for type-checking (the typechecker doesn't need the receiver), but it matters for clients, and for printing of methods. This change fixes interface method receivers at the end of type-checking when we have all relevant information. Fixes #28249 Updates #28005 Change-Id: I96c120fb0e517d7f8a14b8530f0273674569d5ea Reviewed-on: https://go-review.googlesource.com/c/141358 Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-on: https://go-review.googlesource.com/c/146660 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Robert Griesemer <gri@golang.org>
2018-11-01[release-branch.go1.11] database/sql: correctly report MaxIdleClosed statDaniel Theophanes
Previously the MaxIdleClosed counter was incremented when added to the free connection list, rather then when it wasn't added to the free connection list. Flip this logic to correct. Fixes #28325 Change-Id: I405302c14fb985369dab48fbe845e5651afc4ccf Reviewed-on: https://go-review.googlesource.com/c/138578 Run-TryBot: Daniel Theophanes <kardianos@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> (cherry picked from commit 7db509e682891f3bc501c7b23e32e02c64893557) Reviewed-on: https://go-review.googlesource.com/c/146697 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org> Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
2018-11-01[release-branch.go1.11] cmd/trace: don't drop sweep slice detailsHana Kim
For sweep events, we used to modify the ViewerEvent returned from ctx.emitSlice later in order to embed more details about the sweep operation. The trick no longer works after the change https://golang.org/cl/92375 and caused a regression. ctx.emit method encodes the ViewerEvent, so any modification to the ViewerEvent object after ctx.emit returns will not be reflected. Refactor ctx.emitSlice, so ctx.makeSlice can be used when producing slices for SWEEP. ctx.emit* methods are meant to truely emit ViewerEvents. Fixes #27717 Updates #27711 Change-Id: I0b733ebbbfd4facd8714db0535809ec3cab0833d Reviewed-on: https://go-review.googlesource.com/135775 Reviewed-by: Austin Clements <austin@google.com> Run-TryBot: Austin Clements <austin@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> (cherry picked from commit e57f24ab39ff6e0ea50c84518e7f91b3a40cf547) Reviewed-on: https://go-review.googlesource.com/c/146698 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
2018-11-01[release-branch.go1.11] cmd/go/internal/modcmd: remove non-existent -dir flagAgniva De Sarker
Updates #27243 Fixes #27498 Change-Id: If9230244938dabd03b9afaa6600310df8f97fe92 Reviewed-on: https://go-review.googlesource.com/131775 Reviewed-by: Bryan C. Mills <bcmills@google.com> (cherry picked from commit 55ef446026748bea0e9bd5aa35132a07297ff734) Reviewed-on: https://go-review.googlesource.com/c/146717 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
2018-10-30[release-branch.go1.11] internal/poll: advance file position in windows sendfileAlex Brainman
Some versions of Windows (Windows 10 1803) do not set file position after TransmitFile completes. So just use Seek to set file position before returning from sendfile. Fixes #27411 Change-Id: I7a49be10304b5db19dda707b13ac93d338aeb190 Reviewed-on: https://go-review.googlesource.com/131976 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Yasuhiro MATSUMOTO <mattn.jp@gmail.com> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-on: https://go-review.googlesource.com/c/145779 Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
2018-10-29[release-branch.go1.11] cmd/go, cmd/link: silence bogus Apple Xcode warningRuss Cox
Certain installations of Xcode are affected by a bug that causes them to print an inconsequential link-time warning that looks like: ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking. This has nothing to do with Go, and we've sent this repro case to Apple: $ pkgutil --pkg-info=com.apple.pkg.CLTools_Executables | grep version version: 10.0.0.0.1.1535735448 $ clang --version Apple LLVM version 10.0.0 (clang-1000.10.44.2) Target: x86_64-apple-darwin17.7.0 Thread model: posix InstalledDir: /Library/Developer/CommandLineTools/usr/bin $ cat > issue.c int main() { return 0; } ^D $ clang issue.c -framework CoreFoundation ld: warning: text-based stub file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation.tbd and library file /System/Library/Frameworks//CoreFoundation.framework/CoreFoundation are out of sync. Falling back to library file for linking. $ Even if Apple does release a fixed Xcode, many people are seeing this useless warning, and we might as well make it go away. Fixes #26073. Change-Id: Ifc17ba7da1f6b59e233c11ebdab7241cb6656324 Reviewed-on: https://go-review.googlesource.com/c/144112 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Reviewed-by: Andrew Bonventre <andybons@golang.org> (cherry picked from commit 66bb8ddb956c5ee55b471a019fac2c6817c08ef5) Reviewed-on: https://go-review.googlesource.com/c/145458 Run-TryBot: Andrew Bonventre <andybons@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>