aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
AgeCommit message (Collapse)Author
2026-03-31test/codegen: fix broken syntaxKeith Randall
A bunch of tests had broken yet undetected syntax errors in their assembly output regexps. Things like mismatched quotes, using ^ instead of - for negation, etc. In addition, since CL 716060 using commas as separators between regexps doesn't work, and ends up just silently dropping every regexp after the comma. Fix all these things, and add a test to make sure that we're not silently dropping regexps on the floor. After this CL I will do some cleanup to align with CL 716060, like replacing commas and \s with spaces (which was the point of that CL, but wasn't consistently rewritten everywhere). Change-Id: I54f226120a311ead0c6c62eaf5d152ceed106034 Reviewed-on: https://go-review.googlesource.com/c/go/+/760521 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Paul Murphy <paumurph@redhat.com> Auto-Submit: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-31cmd/link, runtime: record size of itabsIan Lance Taylor
We were depending on runtime.etypes immediately following the itabs. However, on AIX, runtime.etypes, as a zero-sized symbol, can float when using external linking. It won't necessarily stay right at the end of the itabs. Rather than worry about this, just record the size of the itab data. In practice it almost always works on AIX, but it fails the runtime test TestSchedPauseMetrics/runtime/debug.WriteHeapDump, which fails when iterating over all the itabs. Tested on AIX. This should fix AIX on the build dashboard. Change-Id: Id3a113b75b93fa8440c047e92f764ab81423df48 Reviewed-on: https://go-review.googlesource.com/c/go/+/760203 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-03-31cmd/compile: fix wrong label loop during rangefunc rewriteCuong Manh Le
During the rangefunc rewrite, the compiler must correctly identify the target of branch statements. When a label is defined within a nested scope - such as inside a function literal or a closure - it can shadow a label with the same name in the outer scope. If the rewrite logic does not account for this shadowing, it may incorrectly associate a branch with a nested label rather than the intended loop label. Since the typechecker already guarantees that labels are unique within their respective scopes, any duplicate label name encountered must belong to a nested scope. These should be skipped to ensure branch computing correctly targets the current range-loop scope. Fixes #78408 Change-Id: I4dce8a4d956f41b3a717a509f8c3f7478720be9f Reviewed-on: https://go-review.googlesource.com/c/go/+/761420 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-31cmd/compile: ensure map/slice clearing expressions are walkedCuong Manh Le
The order pass ensures that initialization operations for clear(expr) are scheduled. However, if 'expr' is a conversion that the walk pass subsequently optimizes away or transforms, the resulting nodes can be left in an un-walked state. These un-walked nodes reach the SSA backend, which does not expect high-level IR, resulting in an ICE. This change ensures the expression is always walked during the transformation of the 'clear' builtin. Fixes #78410 Change-Id: I1997a28af020f39b2d325a58429eff9495048b1f Reviewed-on: https://go-review.googlesource.com/c/go/+/760981 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: David Chase <drchase@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2026-03-31cmd/compile: convert some condmoves in XORJorropo
Similar to CL 685676 but for XOR. Change-Id: Ib5ffd4c13348f176a808b3218fdbbafc2c42794f Reviewed-on: https://go-review.googlesource.com/c/go/+/760921 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-31cmd/compile: convert some condmoves in ORJorropo
Similar to CL 685676 but for OR. Change-Id: I0ddfd457ed9e8888462306138a251ac48ad42084 Reviewed-on: https://go-review.googlesource.com/c/go/+/760920 Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Junyang Shao <shaojunyang@google.com>
2026-03-31sync: replace linkname with importCherry Mui
The sync package uses linkname to access internal/runtime/atomic package's LoadAcquintptr and StoreReluintptr functions. It was not able to import the package when the package was runtime/internal/atomic. Now that it moves to internal/runtime, the sync package can just import it and call the functions normally. Change-Id: Ic7399e33d0e965fdcdf505be67a7f90e0260ddee Reviewed-on: https://go-review.googlesource.com/c/go/+/750160 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-03-30go/types, types2: report an error if constant string overflowsRobert Griesemer
Set a limit of 10 GiB for strings obtained via constant string addition. Fixes #78346. Change-Id: I35dbdff94f3ed32bf69654f4b3da435dad9f6236 Reviewed-on: https://go-review.googlesource.com/c/go/+/761300 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev>
2026-03-30all: fix some minor issues in the commentscuishuang
Change-Id: If6c304efac7a46a9718cdc63ded3d98a26a3a831 Reviewed-on: https://go-review.googlesource.com/c/go/+/760700 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Robert Griesemer <gri@google.com> Reviewed-by: Neal Patel <nealpatel@google.com> Reviewed-by: Fred Sauer <fredsa@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-30cmd/go/internal/doc: document that -all and -short cannot be combinedmatloob
And return an error message. Hopefully we can add support by the end of the cycle, but for now return an error to avoid confusing users. For #77191 Change-Id: I8a673a4bdfe640a04ec67b8bee0b5a056a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/760304 Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-30cmd/compile/internal/noder: swap use of TypeList for []TypeMark Freeman
The noder will need to manipulate type argument lists. Because it is outside types2, it needs exported APIs to do so, which then must also be reflected in go/types. We don't want APIs which only the noder cares about to be surfaced so broadly. It might be better for the noder to use its own representation for type lists; a []Type is fine for now. Change-Id: Ia0917a6d26e00218fc9ccfd443d8d07224b1db5d Reviewed-on: https://go-review.googlesource.com/c/go/+/760360 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-30cmd/compile/internal/noder: add is[Concrete|Generic]Method helpersMark Freeman
The isGenericMethod helper will be necessary for upcoming changes to UIR, though it's not currently used. Since all generic methods are concrete methods, we also define the isConcreteMethod helper to illustrate the subset relationship between the two classes of methods. We use this helper for encoding method dictionaries. Change-Id: Ib7cdd7224fc733553726c8f86c0fe59ad60bff67 Reviewed-on: https://go-review.googlesource.com/c/go/+/759781 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-30cmd/compile/internal/devirtualize: improve debug logsMateusz Poliwczak
Change-Id: Ie8d74d0968c3dfa6fe3454f1d3fdf13d6a6a6944 Reviewed-on: https://go-review.googlesource.com/c/go/+/760162 Auto-Submit: Mateusz Poliwczak <mpoliwczak34@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-30cmd/compile/internal/devirtualize: use pointer identity for type comparisonMateusz Poliwczak
Fixes #78404 Change-Id: I6adc1fb42ad6a3acce21333c6819d0796a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/760161 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-27cmd/link: run TestMachOBuildVersion only on darwinCherry Mui
There is no need to cross build a Mach-O binary in order to test this. Only run it on Mach-O platforms. Also just do native build instead of forcing GOARCH=amd64. For #78266. Change-Id: I7603ba9a51ea4f13411fdb4e159709f981ee755d Reviewed-on: https://go-review.googlesource.com/c/go/+/759260 TryBot-Bypass: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-03-27cmd/go: specify full path to go command when running go tool covdataMichael Matloob
Otherwise the GOROOT will be a post-1.25 GOROOT, while we try to run "go tool covdata" with a go command that's 1.24 or earlier from the post 1.25 toolchain. The 1.24 go command won't be able to find covdata in the 1.25 goroot because go 1.25 and later don't ship with a prebuilt covdata tool. For #71867 Fixes #75031 Change-Id: I770f10a288347ac33cf721d34a2adb1a6a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/756220 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/go/internal/verylongtest: run tests in a separate GOCACHECherry Mui
Based on the timing, the move to verylongtest seems to be related to the start of #78180 flakiness. Run the tests in a separate GOCACHE to isolate even more. Some tests indeed do something unusual, like setting a umask, which could cause files in the build cache to have an unusual permission. I'm not sure whether and how the flaky failure could be related to this. Just give it a shot. Using a fresh GOCACHE might make it rebuild more packages. But it is verylongtest anyway. Make it skip in short mode. For #78180. Change-Id: I5c9f83794d15310ffca8ba3dfa739016a5b8e899 Reviewed-on: https://go-review.googlesource.com/c/go/+/760382 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@golang.org>
2026-03-27Revert "cmd/link: don't run TestExtLinkCmdlineDeterminism in parallel with ↵Cherry Mui
other tests" This reverts CL 759122. Reason for revert: does not help reduce flakes. For #78180. Change-Id: Ia994d0bcc0ab681dd8cca9acbac20ac547647fe7 Reviewed-on: https://go-review.googlesource.com/c/go/+/760381 Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/fix: change -diff to exit 1 if diffs existyongqijia
Currently "go fix -diff" and "go vet -fix -diff" always exit with status 0 even when they print diffs, which is inconsistent with "gofmt -d" (#46289) and "go mod tidy -diff" (#27005) that exit non-zero when diffs are present. The root cause is that the default VetHandleStdout (copyToStdout) simply copies the tool stdout through without checking whether any content was produced. This change installs a new copyAndDetectDiff handler in -diff mode that copies the tool stdout through and calls base.SetExitStatus(1) when content is present, matching the pattern used by "go mod tidy -diff". Fixes #77583 Change-Id: I588fbaae8b3690da2f821240baa4a3b14b78f280 Reviewed-on: https://go-review.googlesource.com/c/go/+/749700 Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/go: add example support to go doc outputNick White
The go doc command now includes a -ex flag to list executable examples. It will also print the code and expected output of an example when passed its name. Fixes #26715 Change-Id: I34b09403cc3cb45655939bd4fe27accec0e141f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/445116 Reviewed-by: Rob Pike <r@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2026-03-27all: remove openbsd/mips64 portTobias Klauser
The openbsd/mips64 port is dead, remove the remaining code specific to that port and clean up build tags. Fixes #61546 Change-Id: I0328b7b76ce1ddacd3a526b3f4ae29eaa1254c3f Reviewed-on: https://go-review.googlesource.com/c/go/+/746480 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Tobias Klauser <tobias.klauser@gmail.com> Reviewed-by: Joel Sing <joel@sing.id.au> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-27cmd/compile/internal/ssa: prove support induction variable pairYoulin Feng
We have two induction variables i and j in the following loop: for i, j := 0, len(s)-1; i < j; i, j = i+1, j-1 { // loop body } This CL enables the prove pass to handle cases where one if block uses two induction variables. Updates #45078 Change-Id: I8b8dc8b7b2d160a796dab1d1e29a00ef4e8e8157 Reviewed-on: https://go-review.googlesource.com/c/go/+/757700 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/compile: use prove to remove no-op OrsJorropo
This is hit 3 times (unique by LOC) when building the std. Change-Id: Ic1fc7b60a129e73470d9bc4f603f4be12d154b0f Reviewed-on: https://go-review.googlesource.com/c/go/+/750342 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-27cmd/compile: remove 68857 And flowLimit workaround in proveJorropo
Change-Id: Id8baeb89e6e11a01d53cd63c665f0b2966f50392 Reviewed-on: https://go-review.googlesource.com/c/go/+/750341 Reviewed-by: Mark Freeman <markfreeman@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-27cmd/compile: use prove to remove no-op AndsJorropo
This is hit 308 times (unique by LOC) when building the std. There are many hits in defer generated code. My original intent was to optimize cryptographic code that uses And to implement modulus by a power of two but the number is always smaller than the modulus, it also works there but there (unsurprisingly) far fewer hits. Change-Id: Ia7a9a57099b98de966673c6e8231ef09f7c80964 Reviewed-on: https://go-review.googlesource.com/c/go/+/750200 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/link: group gcmask symbols, move them to noptrbssIan Lance Taylor
Also take them out of the symbol table. A new symbol runtime.gcmask.* marks where they start in BSS, and can be used to find them if anybody cares. Also stop checking for gcprog symbols that we no longer define. Change-Id: I4060d8e9350c20568f020172caacd0439337cd2d Reviewed-on: https://go-review.googlesource.com/c/go/+/729880 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Ian Lance Taylor <iant@golang.org>
2026-03-26cmd/internal/obj/riscv: add assembly support of Zbc extensionXueqi Luo
The Zbc extension adds carry-less multiplication instructions for polynomial arithmetic over GF(2), which is used in cryptographic algorithms and error-correcting codes. The instructions included are: clmul, clmulh, and clmulr. Change-Id: I77a40add1a795c7b90b478dc65835c689e82167a GitHub-Last-Rev: 53790f0aafa46af2ed24183f58292df7f9fb224a GitHub-Pull-Request: golang/go#76301 Reviewed-on: https://go-review.googlesource.com/c/go/+/720520 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Joel Sing <joel@sing.id.au> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/compile/internal/noder: set hasShape for shaped functionsMark Freeman
A signature with a shape will be overwritten using shapeSig, but it arguably still has a shape because it's using a shaped dictionary. This mimics the approach for ObjType. Change-Id: I4646cd73129606772a9218662de76a37217366b4 Reviewed-on: https://go-review.googlesource.com/c/go/+/759721 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-26cmd/compile/internal/noder: shapeSig must return shaped signaturesMark Freeman
Suppose a signature f[P any]() shaped to f[go.shape.int](). This function does not flag f[go.shape.int]() as having a shape because it does not mention a shaped type in its parameter or return fields. This doesn't seem right. Change-Id: I87c4e3b259328b7d27ff0a98d65ed400b4895a69 Reviewed-on: https://go-review.googlesource.com/c/go/+/759660 Auto-Submit: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Robert Griesemer <gri@google.com>
2026-03-26cmd/go: default to Go 1.20 GODEBUGs in GOPATH modeMichael Matloob
We used MainModules.GoVersion to get the Go version to use for godebugs in GOPATH mode. That returned Go 1.16 which is the default version for modules to use when they don't have a go directive, but is modules specific and doesn't make sense for GOPATH mode. Set the version to 1.20. For #73973 Change-Id: Iaa5bb77498d5860f2372ffda8a6b88a26a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/759240 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: t hepudds <thepudds1460@gmail.com> Reviewed-by: Michael Matloob <matloob@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@golang.org>
2026-03-26cmd/compile: on ARM64 merge SRA into TBZ & TBNZJorropo
Change-Id: I9596dbca8991c93c7543d10dc1b155056dfa7db3 Reviewed-on: https://go-review.googlesource.com/c/go/+/759500 Reviewed-by: Keith Randall <khr@golang.org> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com>
2026-03-26cmd/compile: on ARM64 merge ROR into TBZ & TBNZJorropo
Change-Id: Ib37b35dfff6236c59c0242c3b7d979c95aefbb8b Reviewed-on: https://go-review.googlesource.com/c/go/+/750321 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Mark Freeman <markfreeman@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com>
2026-03-26cmd/compile: on ARM64 merge shifts into TBZ & TBNZJorropo
Change-Id: I4dff3ba1462848f408257cbadedf202e62d1ea69 Reviewed-on: https://go-review.googlesource.com/c/go/+/750320 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2026-03-26runtime, cmd/link: remove itablinksIan Lance Taylor
Instead of keeping a separate list of pointers to itabs, just walk through the itabs themselves. For #6853 Change-Id: If030bd64fbd01d73b0bf8495f6c9826ed2e61568 Reviewed-on: https://go-review.googlesource.com/c/go/+/729201 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-26cmd/compile: skip incomplete types in needWrapperCuong Manh Le
A recursive pointer type *T may still be a TFORW when the compiler determines if method wrappers are needed. This leads to an incorrect decision and triggers an internal compiler error. Fix this by skipping incomplete types during the method wrapper generation check. Fixes #78295 Change-Id: I4005e525e9b076c6656aed5419283c0418edcac6 Reviewed-on: https://go-review.googlesource.com/c/go/+/758922 Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-26cmd/compile: do not invert loops that would overflow or underflowJorropo
On the final iteration we need space below start (which becomes end) such that i-step does not overflow or underflow. In other words the code used to assume that the last time the loop header execute `start < i - step` (or `<=`, `>` `>=` based on the loop) is always false. And it seems correct since by definition the only way for it to be the last's loop header execution is when the condition becomes false. However here is an example with uint (even tho the code doesn't already support them) to make things simpler: start = 1 i = 2 step = 100 We do 2 - 100 which should give us 1 < -98 == false breaking the loop; Instead we get 18446744073709551518 which gives 1 < 18446744073709551518 == true which keeps the loop going. This patch fixes this issue by ensuring that in the last execution of a loop header the induction variable does not underflow or overflow. Fixes #78303 Change-Id: I64e8e8592b023d79fdbc7f1598d584726ed601f5 Reviewed-on: https://go-review.googlesource.com/c/go/+/758801 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-26cmd/compile: fix missing walk for OAS2RECV nodeCuong Manh Le
When channel receive operator is used in the context that requires conversion to destination type, there's an implicit conversion operator inserted by typecheck. This typecheck-ed node is un-walked, then passing to the backend as-is, causing the ICE. Fixes #78313 Change-Id: Ibbc70cbd2d8069cc7cf81934406aa68c4da2686a Reviewed-on: https://go-review.googlesource.com/c/go/+/758660 Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
2026-03-25cmd/link: fix host object's .pdata entries orderqmuntal
Host objects are expected to have their .pdata entries in the correct order, but the Go internal linker might reorder some of the functions associated with the .pdata entries. This causes the .pdata section in the final binary to have entries in the wrong order, and therefore issues with unwinding on Windows. The fix is to treat the .pdata entries of host objects as individual symbols that will be retained only if the function they are associated with is retained. Also, those entries will be sorted together with the .pdata entries emitted by the Go compiler, ensuring the correct order in the final binary. Fixes #65116 Change-Id: I421471b2aef519b0c20707a40c4b7957db5d2ed5 Reviewed-on: https://go-review.googlesource.com/c/go/+/754080 Reviewed-by: Alex Brainman <alex.brainman@gmail.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25cmd/dist: try to use jj commit info for devel versionmatloob
Fixes #78369 Change-Id: Icb8bb9822eac78934efc313f50221de56a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/759320 Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Auto-Submit: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Matloob <matloob@google.com>
2026-03-25cmd/compile: preserve variadic signature on range-over-funcCuong Manh Le
When rewriting range-over-func loops, copy the variadic bit from the original function type into the synthesized body closure's type info. This keeps the generated closure signature aligned with the source function and avoids losing variadic-ness during rewrite. Fixes #78314 Change-Id: I4b5f4628e8c8c14d4ff89dd6b996837264c5cb61 Reviewed-on: https://go-review.googlesource.com/c/go/+/758041 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Jakub Ciolek <jakub@ciolek.dev> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-25cmd/link: don't run TestExtLinkCmdlineDeterminism in parallel with other testsCherry Mui
Based on the investigation of #78180, it appears that for different runs the go command picks up different object from the build cache for the runtime/cgo package. One possible situation could be that as the test runs in parallel with other tests, some other test builds runtime/cgo at same time, and somehow that build is not deterministic, causes different objects of runtime/cgo being written to the build cache. Let's see if running the test not in parallel helps. The test process may still run in parallel with other processes, which could also build runtime/cgo and interfere, so this may be just best effort. If the build of runtime/cgo is deterministic, this shouldn't be necessary. For #78180. Change-Id: If078f141febd33f063fe2d564c4150223a9784ef Reviewed-on: https://go-review.googlesource.com/c/go/+/759122 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
2026-03-25cmd/go: add information about GODEBUGs to go help gopathMichael Matloob
And make it clear that standard library tests won't run properly with GO111MODULE=off. Fixes #73973 Fixes #69202 Change-Id: I8c71c739e1da80fbf2e13f84ecaf9c346a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/758720 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@google.com>
2026-03-25cmd/dist: add GO_TEST_ASMFLAGS to set -asmflags during dist testDmitri Shuralyov
If we run into a need for finer control over when -asmflags gets set, there can be an asmflags field added to goTest, analogously to the existing gcflags and ldflags fields. Start with a minimal change for what is currently needed, since not adding something we ourselves don't use makes it easier to avoid inadvertently ending up maintaining it because we can't be sure whether someone else started to depend on it. For #77427. Change-Id: I5e80874861cadf95fe770af6712b2c3f172c990a Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-spectre Reviewed-on: https://go-review.googlesource.com/c/go/+/758740 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
2026-03-25cmd/compile: ppc64 fold (x+x)<<c into x<<(c+1)Jayanth Krishnamurthy jayanth.krishnamurthy@ibm.com
On ppc64/ppc64le, rewrite (x + x) << c to x << (c+1) for constant shifts. This removes an ADD, shortens the dependency chain, and reduces code size. Add rules for both 64-bit (SLDconst) and 32-bit (SLWconst), and extend test/codegen/shift.go with ppc64x checks to assert a single SLD/SLW and forbid ADD. Aligns ppc64 with other architectures that already assert similar codegen in shift.go. Change-Id: Ie564afbb029a5bd48887b82b0c455ca1dddd5508 Cq-Include-Trybots: luci.golang.try:gotip-linux-ppc64_power10,gotip-linux-ppc64_power8,gotip-linux-ppc64le_power8,gotip-linux-ppc64le_power9,gotip-linux-ppc64le_power10 Reviewed-on: https://go-review.googlesource.com/c/go/+/712000 Reviewed-by: Archana Ravindar <aravinda@redhat.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Carlos Amedee <carlos@golang.org>
2026-03-24cmd/link: print more information in TestExtLinkCmdlineDeterminismCherry Mui
Print more information in TestExtLinkCmdlineDeterminism to debug test failure. For #78180 Change-Id: I7e95eceb957805588c5dbb272370476d2378ea7e Reviewed-on: https://go-review.googlesource.com/c/go/+/758823 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Cherry Mui <cherryyz@google.com> TryBot-Bypass: Cherry Mui <cherryyz@google.com>
2026-03-24cmd/go/testdata/vcstest: explicitly set invalid-version's branch to mainmatloob
Fixes #78323 Change-Id: Id527f3a162969309b7103e5f0e0cc6496a6a6964 Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest-git2.24.0 Reviewed-on: https://go-review.googlesource.com/c/go/+/758820 Reviewed-by: Michael Matloob <matloob@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Michael Matloob <matloob@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-24cmd/compile: handle string literals in FIPS mode consistentlyCherry Mui
There are different code paths for compiling a composite literal, e.g. small vs. large, fully static vs. partially static. Following CL 755600, we need to apply the condition for string literals in FIPS mode consistently in all places. Enhance the test to check that not only does the code compile, the same code inside and outside of FIPS mode produce the same result. If the condition is not consistent in the compiler, it may compile the code, but not all the fields are actually assigned. Fixes #78173. Change-Id: Icaf673bd4798d4312d86c39b147d7fd33b9dae2c Reviewed-on: https://go-review.googlesource.com/c/go/+/756260 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com>
2026-03-24internal/abi, cmd/link: centralize type descriptor size calculationJake Bailey
The linker hardcoded the calculation for some types, which caused me some annoyance in CL 711560 because I didn't know it needed to be updated (and it took me a long time to find the hardcoded value). Move this calculation over to the abi package, similar to other funcs. Then update rttype.Init to also check that the function works, like again like other funcs in this package. This actually caught a latent bug; decodetypeMethods was incorrectly calculating the size for the Interface case! Change-Id: Iaa66055061b68ec93c9912ae6aa6e605260f52a8 Reviewed-on: https://go-review.googlesource.com/c/go/+/749961 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2026-03-24internal/runtime/maps: add GOEXPERIMENT=mapsplitgroup for KKKKVVVV slot orderJake Bailey
Map groups are currently: type group struct { ctrl uint64 slots [8]slot } type slot struct { key K elem E } If the element type is struct{}, the slot will be padded so that the address of the elem is unique rather than pointing outside the alloc. This has the effect of map[K]struct{} wasting space due to the extra byte and padding, making it no better than map[K]bool. This CL changes the group layout to instead place keys and elems together, as they used to be before swiss maps: type group struct { ctrl uint64 keys [8]K elems [8]V } This is an alternative to CL 701976, which I suspect will have better performance. Keys placed together should lead to better cache behavior, at the cost of more expensive elem lookups, since the elems are not a fixed offset from their keys. This change is locked behind GOEXPERIMENT=mapsplitgroup. Updates #70835 Updates #71368 Change-Id: Ide8d1406ae4ab636f86edc40e0640cc80653197c Reviewed-on: https://go-review.googlesource.com/c/go/+/711560 Reviewed-by: Michael Pratt <mpratt@google.com> Auto-Submit: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
2026-03-24cmd/go: document that workspace use paths are not resolved through symlinksgulmix
The use directive in go.work files compares module directory paths literally without resolving symbolic links. A use directive that names a symlink to a directory is not interchangeable with one that names the symlink's target. Document this in the help text for "go help work" and "go help work use". Also note that "go work use -r" ignores symlinks to directories within the search tree. Fixes #77949 Change-Id: I5361b615e40b5585963f7694a543acf3b40fa051 Reviewed-on: https://go-review.googlesource.com/c/go/+/758440 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Matloob <matloob@golang.org> Auto-Submit: Michael Matloob <matloob@google.com> Reviewed-by: Michael Matloob <matloob@google.com>