Ian Lance Taylor [Thu, 5 Feb 2026 23:08:19 +0000 (15:08 -0800)]
cmd/link: run ELF tests on Solaris
Change-Id: If06d5b5f4a491ea80f001d930f3f4a5f22290460
Reviewed-on: https://go-review.googlesource.com/c/go/+/742560 Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Ian Lance Taylor [Sat, 31 Jan 2026 03:18:14 +0000 (19:18 -0800)]
cmd/link: only run ELF tests on ELF systems
Running these tests on other systems is a pointless waste of time.
This runs cmd/link/internal/ld/elf_test.go in the same cases that
we run cmd/link/elf_test.go.
Change-Id: I318fb5c2de9e4cfdb976bc2389c72cede6661b47
Reviewed-on: https://go-review.googlesource.com/c/go/+/740782 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
kami-sama [Wed, 4 Feb 2026 08:24:56 +0000 (13:54 +0530)]
net/url: add test case to ResolveReference
This adds a test case to resolveReferenceTests to ensure that a
relative path is correctly appended to a base URL that ends with a
trailing slash.
Change-Id: I94ea65355bb96f23acff09a3992c9dcf6e47da60
Reviewed-on: https://go-review.googlesource.com/c/go/+/741880
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Ian Lance Taylor [Sat, 31 Jan 2026 03:15:31 +0000 (19:15 -0800)]
cmd/link: make TestTypePlacement work on AIX
The existing code was just wrong. On AIX the go.type section is
folded into the .text section (when internally linking),
or the .data section (when externally linking).
It follows that the data section adjustment is useless when
internally linking, which is currently what happens with this test.
Change-Id: Icf8ac07f754fdcf08b9d3dfffde83b3391c9404b
Reviewed-on: https://go-review.googlesource.com/c/go/+/740821
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Ian Lance Taylor [Sat, 31 Jan 2026 03:06:19 +0000 (19:06 -0800)]
cmd/link: use correct alignment for type descriptors on AIX
CL 724261 changed the linker to put all type descriptors that
are used for typelinks in a single list. This caused trouble on AIX when
linking externally, because the AIX linker aligns symbols individually,
rather than honoring the layout of the object file generated by the
internal linker.
I fixed internal linking problems with CL 740220,
but that just made things worse for the external linker.
This CL rolls back 740220, and adds commentary.
With this CL we force a smaller alignment for type descriptors,
use the same alignment for runtime.types and type:*,
and use a consistent size for runtime.types in all cases.
With this change all the type descriptor related code
passes again on AIX, except for the new TestTypePlacement test
which I will fix in a followup CL.
Fixes #77400
Change-Id: I9f25847eb0588001cb4ce453f211a655400d6a59
Reviewed-on: https://go-review.googlesource.com/c/go/+/740820 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Keith Randall [Fri, 2 Jan 2026 21:42:00 +0000 (13:42 -0800)]
cmd/link: align covctrs symbol
If we start the covctrs blob at an odd alignment, then covctrs will
not be correctly aligned. Each individual entry is aligned properly,
but the start marker may be before any padding inserted to enforce
that alignment.
Fixes #58936
Change-Id: I802fbe40eacfa5a3c8c4864e078b0e078da956d5
Reviewed-on: https://go-review.googlesource.com/c/go/+/733740
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com>
Dmitri Shuralyov [Sat, 24 Jan 2026 18:03:14 +0000 (13:03 -0500)]
net/http: fix WaitGroup race in TestTransportNoReuseAfterEarlyResponse
The remaining race reported in go.dev/issue/66519 is that it's possible
for copying.Wait to start running before all copying.Add calls complete.
It happens infrequently as is, but padding both Wait and Add calls with
a 100 ms sleep makes it highly reproducible.
Arranging the Add call to happen before responding "foo" to the POST
request should be enough to guarantee that Wait doesn't start running
until all Add calls have already happened.
While here, delete a blank line that gets more in the way of reading
error handling code than it helps.
For #64252.
Fixes #66519 (optimistically).
Change-Id: Ibf264d8cc5ffc2495e8ae8e66a15591310c65e71
Reviewed-on: https://go-review.googlesource.com/c/go/+/739060 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
qmuntal [Thu, 5 Feb 2026 14:48:51 +0000 (15:48 +0100)]
internal/poll: move isBlocking checks to inside execIO
This is a step towards deferring adding the handle to IOCP until the
first IO operation.
Having all isBlocking checks inside execIO will make it easier to delay
getting that information until the first IO operation.
It also makes the code simpler, as Pread and Pwrite now only modify
the overlapped object offset, not the one in the FD struct, so they
don't need to reverse the offset change after the IO operation.
For #76391
Cq-Include-Trybots: luci.golang.try:gotip-windows-amd64-longtest,gotip-windows-amd64-race
Change-Id: Iea680c502c9417b9569a0b1a9da6f7e6bf916f6a
Reviewed-on: https://go-review.googlesource.com/c/go/+/742283
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
qmuntal [Thu, 5 Feb 2026 12:37:08 +0000 (13:37 +0100)]
internal/poll: optimize socket completion modes
FILE_SKIP_SET_EVENT_ON_HANDLE is always safe to use.
FILE_SKIP_COMPLETION_PORT_ON_SUCCESS is safe as long as the socket
is provided by an IFS provider.
While here, stop using the kindFileNet type, it doesn't provide any
value.
Fixes #77448
Change-Id: Ib3dc0d68c7ff57b6a1f15f017e60a092e4b87f46
Reviewed-on: https://go-review.googlesource.com/c/go/+/742281 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
qmuntal [Thu, 5 Feb 2026 12:16:12 +0000 (13:16 +0100)]
internal/poll: make waitIO more idempontent
This is a step towards deferring adding the handle to IOCP until the
first IO operation.
waitIO should use the overlapped event if it is provided, regardless of
whether FD is pollable or not. This simplifies reasoning about the code
and makes it more robust to race conditions.
While here, remove the panic in waitIO that was triggered when called
with a blocking handle. That shouldn't happen, but if it does,
fd.pd.wait will return an error that will already be promoted to
a panic.
For #76391
Change-Id: I8e84592568a3ef66e71161eb2c5f515dde638117
Reviewed-on: https://go-review.googlesource.com/c/go/+/742280 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ravi Sastry Kadali [Mon, 26 Jan 2026 02:29:30 +0000 (18:29 -0800)]
database/sql: ensure Null* types have Valid=false when Scan returns error
The Scan methods for NullString, NullInt64, NullInt32, NullFloat64,
NullBool, and NullTime set Valid=true before calling convertAssign.
If convertAssign returns an error, Valid remains true, which creates
an inconsistent state where Valid=true but err!=nil.
Fix by setting Valid only after successful conversion.
Fixes #45662
Change-Id: I855a20abbe517ed017f7c9b8f5603b17bd9d487d
Reviewed-on: https://go-review.googlesource.com/c/go/+/739160
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Michael Pratt <mpratt@google.com>
Tom Thorogood [Sun, 11 Jan 2026 07:00:06 +0000 (17:30 +1030)]
simd/archsimd: correct algorithm name in SHA256 ops documentation
The three SHA256 ops (SHA256Message1, SHA256Message2 and SHA256TwoRounds)
all incorrectly referred to the SHA1 algorithm in their documentation
rather than SHA256.
Change-Id: Id6c1bfe4fee4517c0e498fb063cc9112464bc1e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/735420 Reviewed-by: Junyang Shao <shaojunyang@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Guoqi Chen [Wed, 4 Feb 2026 07:25:07 +0000 (15:25 +0800)]
cmd/compile: allow equal functions to perform unaligned load on loong64
The Go compiler always generates Loong64 binaries, which can execute any
processor of LA364, LA464, LA664 or higher core. And these processors
support unaligned memory access [1].
Change-Id: I1870080e0122a7d136685e3045699d0cf1e4194d
Reviewed-on: https://go-review.googlesource.com/c/go/+/742260
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Meidan Li <limeidan@loongson.cn> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Michal Pristas [Wed, 4 Feb 2026 09:36:59 +0000 (09:36 +0000)]
os: support deleting inaccessible files in RemoveAll
windows: retry file open with DELETE access after access denied
Additional access rights when opening files, including SYNCHRONIZE,
break deletion when the caller has FILE_DELETE_CHILD on the parent
directory but not the file. Retry with DELETE only restores correct
Windows semantics.
Fixes #77402
Change-Id: Ie53bc6f1673de1a8af4dcfb7496daf99e71098cb
GitHub-Last-Rev: 0ad635cf1a13c0242e3b1922cf47a8c594dd7215
GitHub-Pull-Request: golang/go#77403
Reviewed-on: https://go-review.googlesource.com/c/go/+/741040 Reviewed-by: Quim Muntal <quimmuntal@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
kovan [Tue, 3 Feb 2026 15:10:47 +0000 (16:10 +0100)]
crypto/tls: fix broken link in KeyLogWriter documentation
The Mozilla developer documentation link for the NSS key log format
has been broken since early 2022. Update the documentation to point
to the IETF TLS working group draft which is currently in the RFC
publication queue.
Fixes #63331
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change-Id: I1a87cca839e503790170a6f3a48bef3b4c6bd624
Reviewed-on: https://go-review.googlesource.com/c/go/+/741444 Reviewed-by: Daniel McCarney <daniel@binaryparadox.net>
Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Sean Liao <sean@liao.dev>
Auto-Submit: Michael Pratt <mpratt@google.com>
Fix a typo in findIntrinsic function where "GrtCallerSP" should be
"GetCallerSP". This typo was in the condition checking for runtime
intrinsic functions that don't have definitions.
Fixes #77432
Change-Id: I8667a42456b4b2c4533dfcbca198b46793f71c89
GitHub-Last-Rev: 00ea4034177381ca7f851ae002487dba3dba20f8
GitHub-Pull-Request: golang/go#77476
Reviewed-on: https://go-review.googlesource.com/c/go/+/742680 Reviewed-by: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Jorropo <jorropo.pgm@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jonah Uellenberg [Fri, 6 Feb 2026 02:48:07 +0000 (02:48 +0000)]
runtime: add explicit lower bounds check to decoderune
decoderune is only called by generated code, so we can guarantee that
it's non-negative. This allows eliminating the automatic bounds check in
it.
To make this work, we need to expand the existing optimization to uints.
This generally enables BCE for cases like this:
```go
func test(list []int, idx uint64) int {
if idx >= uint64(len(list)) {
return 0
}
list1 := list[idx:]
return list1[0]
}
```
Change-Id: I86a51b26ca0e63522dec99f7d6efe6bdcd2d6487
GitHub-Last-Rev: 82d44e0a080b53ee02c31ee1f92a8a0acd8d2621
GitHub-Pull-Request: golang/go#76610
Reviewed-on: https://go-review.googlesource.com/c/go/+/725101 Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
Ian Lance Taylor [Thu, 5 Feb 2026 04:58:51 +0000 (20:58 -0800)]
cmd/link: ignore GCC generated .wm4/.wm8 symbols with no type
Fixes #77436
Change-Id: I37d852a89678c929156c4765e774c819eb515e6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/742220 Reviewed-by: Michael Knyszek <mknyszek@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>
Ian Lance Taylor [Wed, 4 Feb 2026 20:42:44 +0000 (12:42 -0800)]
cmd/link: correct error message in loadelf.Load
The message said we were ignoring the symbols, but we aren't.
We are treating them as an error.
For #77436
Change-Id: I5492d81717c539b09f6956b591178f1f3a42893d
Reviewed-on: https://go-review.googlesource.com/c/go/+/742060 Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Jorropo [Tue, 2 Dec 2025 04:06:09 +0000 (05:06 +0100)]
net/http: remove hasPort and simplify logic
Fixes #76651
Change-Id: I306e127375095bc0caedb01ac458107cfec5f085
Reviewed-on: https://go-review.googlesource.com/c/go/+/725740
Auto-Submit: Sean Liao <sean@liao.dev>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Sean Liao <sean@liao.dev>
Cuong Manh Le [Thu, 5 Feb 2026 14:16:55 +0000 (21:16 +0700)]
cmd/compile: fix SIMD type parameter instantiation
When a SIMD type is used to instantiate a type parameter, the SIMD's
underlying type is its shape. This shape type must be marked as a SIMD
type, otherwise, the backend will confuse and does not know how to put
this SIMD type to proper registers.
Fixing this by marking a type as SIMD type if its underlying is already
a SIMD one.
Fixes #77444
Change-Id: I745c474469889c94bc68435472ba4820e9f752a1
Reviewed-on: https://go-review.googlesource.com/c/go/+/742320
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
Rhys Hiltner [Tue, 3 Feb 2026 17:23:33 +0000 (09:23 -0800)]
log/slog: correct method names in MultiHandler docs
Fixes #77428
Change-Id: I02d76ac9220fb2e0df404e4a446953bc0b56475f
Reviewed-on: https://go-review.googlesource.com/c/go/+/741560
Auto-Submit: Rhys Hiltner <rhys.hiltner@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Michal Bohuslávek [Wed, 14 Jan 2026 11:54:22 +0000 (12:54 +0100)]
bufio: fix doc link to Reset method
On https://pkg.go.dev/bufio#Reader, the reference to the Reset
method is rendered as [Reset]. Fix it by referring to the method
via its type.
Change-Id: I4256ca80ebef7b850e6a97b96503dd7178cb361b
Reviewed-on: https://go-review.googlesource.com/c/go/+/736320
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Daniel Morsing <daniel.morsing@gmail.com>
Auto-Submit: Michael Knyszek <mknyszek@google.com> Reviewed-by: Robert Griesemer <gri@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com>
kovan [Tue, 3 Feb 2026 15:07:55 +0000 (16:07 +0100)]
runtime: clarify g object vs stack memory lifetime in HACKING.md
The documentation states that g objects are "never freed" but does not
clarify that goroutine stack memory is managed separately. This can be
confusing as it might imply that all goroutine memory (including stacks)
is retained indefinitely.
Add a paragraph in the Stacks section clarifying that:
- Stack memory may be freed when a goroutine exits
- Stacks at the starting size are retained for reuse
- Grown stacks are freed and reallocated when needed
- The g object itself is never freed, only its stack memory
Fixes #65843
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Change-Id: Icb3afbb5392401d695ab129c341ce10106e5a4f0
Reviewed-on: https://go-review.googlesource.com/c/go/+/741505 Reviewed-by: Michael Knyszek <mknyszek@google.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Damien Neil [Thu, 5 Feb 2026 23:56:13 +0000 (15:56 -0800)]
crypto/tls: avoid data race when canceling a QUICConn's Context
Methods on QUICConn are synchronous:
The connection state is expected to change only in reaction
to a user calling a QUICConn method, and the state change
should finish completely before the method returns.
The connection context provided to QUICConn.Start violates
this model, because canceling the context causes an
asynchronous state change.
Prior to CL 719040, this caused no problems because canceling
the context did not cause any user-visible state changes.
In particular, canceling the context did not cause any new
events to be immediately returned by QUICConn.NextEvent.
CL 719040 introduced a new error event. Now, canceling a
QUICConn's context causes a new connection event to be
generated.
Receiving this event causes a data race visible to the
race detector, but the core problem is not the data race
itself: It's that an asynchronous event (canceling the
connection context) causes an change to the connection
events.
Fix this race by reworking the handling of QUICConn
context cancellation a bit. We no longer react to
cancellation while control of the connection lies
with the user. We only process cancellation as
part of a user call, such as QUICConn.Close
or QUICConn.HandleData.
Fixes #77274
Change-Id: If2e0f73618c4852114e0931b6bd0cb0b6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/742561
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Damien Neil <dneil@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
amusman [Fri, 23 Aug 2024 21:25:32 +0000 (00:25 +0300)]
cmd/compile: CSE loads across disjoint stores
Enable partitioning together memory user instructions, such as regular
loads, across disjoint memory defining instructions (currently only stores).
Keep a memory table to remember appropriate memory definition for any
supported memory using instruction. This allows to match more load
instructions and potentially may be further improved with handling
additional cases in the common utility `disjoint`.
Generally this change allows to improve code size. For example, here is
code size difference on linux_arm64:
This change also tends to increase number of NilChecks matched, which
led to moving statement boundary marks from OpNilCheck to its user
instruction (such as OpOffPtr), where it is more likely to be lost
during subsequent optimizations - e.g. see #75249. Because we don't
remove the nil checks in cse, here we also update it to not move
the statement boundary marks from OpNilCheck - the later related
optimizations can handle that better.
Change-Id: Iddf4aa13d44de78ffecf6ccb4c0fd1d35533e844
Reviewed-on: https://go-review.googlesource.com/c/go/+/608115
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Corentin Kerisit [Tue, 16 Dec 2025 23:53:01 +0000 (23:53 +0000)]
cmd/link: add more clang driver flags when testing flag
This changes does 2 things:
- Move `-L` to `prefixesToKeep` since it allows providing a custom
default libs search path.
- Allow various flags that impact the behaviour of the clang driver.
The latter allows for LLVM only toolchains to be compatible with
linkerFlagSupported checks.
The end goal of this PR is to allow fully hermetic toolchains,
especially pure LLVM ones, to be used to cross-compile CGO.
Fixes #76825
Change-Id: I2311c9566ce9c7e8f6b325258af58eb333663cf0
GitHub-Last-Rev: 74342aae35124cf174a3f8b888999ffd4cea191f
GitHub-Pull-Request: golang/go#76858
Reviewed-on: https://go-review.googlesource.com/c/go/+/730561
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Keith Randall [Wed, 4 Feb 2026 23:29:40 +0000 (15:29 -0800)]
cmd/compile: don't double-walk the map argument of clear
mkcallstmt1 already walks the map argument of clear. mapClear then
walks it again, which can cause problems if it is some syntax that is
non-idempotent under walk. That is the case for the new way map
lookups are being lowered in CL 736020.
Fixes #77435
Change-Id: Ib2f6d7f2270308c2462aa276ed4413aaf7799fe3
Reviewed-on: https://go-review.googlesource.com/c/go/+/742120
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
Change-Id: I7e84d52ac8d25991595d1b0480334fe9d1a84ffb
Reviewed-on: https://go-review.googlesource.com/c/go/+/727520 Reviewed-by: Sean Liao <sean@liao.dev> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Sean Liao <sean@liao.dev> Reviewed-by: Carlos Amedee <carlos@golang.org>
Олег Световидов [Tue, 3 Feb 2026 08:02:27 +0000 (11:02 +0300)]
internal/stringslite: remove duplicate code in Index
Merge two nearly identical loops into one by selecting the fallback
method (IndexString vs IndexRabinKarp) inside the loop based on
whether n <= bytealg.MaxLen.
Fixes #77364#
Change-Id: Iefbef60922ca24e4dda3016127f54290096bcfed
Reviewed-on: https://go-review.googlesource.com/c/go/+/741340 Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Roland Shoemaker [Tue, 3 Feb 2026 02:29:51 +0000 (18:29 -0800)]
cmd/go: fix pkg-config flag sanitization
Implement a new pkg-config safe flag list (containing everything except
for --log-file) and use that when checking flags passed to pkg-config,
instead of using checkCompilerFlags.
Fixes #77387
Change-Id: Id6141d0a2934053aa43e3aa8ce402bd499c4c028
Reviewed-on: https://go-review.googlesource.com/c/go/+/741042
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Roland Shoemaker <roland@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
qmuntal [Fri, 30 Jan 2026 13:26:57 +0000 (14:26 +0100)]
internal/poll: unlock read lock if write lock fails in readWriteLock
If the write lock acquisition fails, the read lock acquired earlier is
not released, leading to a potential deadlock.
The deadlock shouldn't occur because when the write lock fails, it
indicates that the FD is closing, and no other goroutine should be
holding the read lock. However, better to be safe and release the read
lock in such cases.
Change-Id: If593c36040a97357f835b42bb3133ff1dc55a638
Reviewed-on: https://go-review.googlesource.com/c/go/+/740560 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
Ian Lance Taylor [Sat, 31 Jan 2026 02:42:27 +0000 (18:42 -0800)]
reflect, runtime: adjust user-created GCData on AIX
On AIX the runtime adjusts the GCData field in getGCMaskOnDemand
to account for the AIX dynamic loader moving the data section.
That works fine for statically generated types,
but it breaks user generated types. The user generated type
will have a normal, correct, pointer, and adjusting the pointer
will make it point elsewhere.
This all happens to work OK when doing an external link,
because in that case we do have dynamic relocs and there is no adjustment.
But it fails with an internal link.
This CL fixes the problem by applying a reverse adjustment to
user generated types, so that the adjustment winds up with the
original pointer value.
Change-Id: Ibf3199b9ffb36e79af134fbed41db2853297de74
Reviewed-on: https://go-review.googlesource.com/c/go/+/740800 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
Ian Lance Taylor [Fri, 30 Jan 2026 23:33:49 +0000 (15:33 -0800)]
cmd/cgo: use objdir consistently, create it as needed
Previously we added a slash to the end of objdir only after
processing input files. The effect was that the temporary gcc
output files were placed in /tmp, using objdir as a prefix.
Those output files were not removed by anything.
Now we consistently use objdir as a directory, not a prefix.
We only create it when needed; there is already a test for that in
cmd/go/testdata/script/build_cwd_newline.txt.
Change-Id: Ie66d9c04ecc3c0f5950fc1111c74e1d01c67304c
Reviewed-on: https://go-review.googlesource.com/c/go/+/740742
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org> Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ian Lance Taylor [Wed, 19 Nov 2025 00:24:04 +0000 (16:24 -0800)]
cmd/go: rewrite cgo names to "C." in compiler error messages
We used to do this but it broke in Go 1.10. This restores the rewrite,
but only applied to compiler output for packages that use cgo.
That is all that the original rewrite applied to anyhow.
Fixes #76339
Change-Id: Ife8ee858ddd0ff7bcc7423455b2eabf8381b7bde
Reviewed-on: https://go-review.googlesource.com/c/go/+/721821 Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Roland Shoemaker <roland@golang.org>
David Chase [Fri, 30 Jan 2026 06:46:05 +0000 (08:46 +0200)]
cmd/compile: enhance astdump flag to also generate HTML
AI-generated code, 3 merged commits, plus a LOT of hand
cleanups and tweaks, including removing cargo-culted dead
code from the SSA example, reorganizing CSS and JS out of a
single giant comment, using defer appropriately to ensure
balanced open/close tags, running output through tidy to
check compliance. Prompts are included for reference.
This is intended to produce an HTML file in the style of "ssa.html",
but for AST. The result of various phases appears in columns,
which can be scrolled side to side, and also dragged sideways
to make them wider (because AST tends wide).
This supports three kinds of highlighting, which I tweaked
along the way to make them (in my opinion) more useful.
1) Node outlining. This outlines a node and all of its subtrees.
When the cursor is a "cell" (outlined cross) node highlighting
is available. Note that "NAME" nodes are repeated within the
tree, so click on one of these will outline every occurrence.
This is actually done with pointer identity.
2) Name highlighting, available with a "crosshair" cursor.
This highlights a name, e.g. "autotmp_1".
3) Position highlighting, available with a "crosshair" cursor.
This highlights either a file (all occurrences of that file's positions),
a line within a file (all occurrences of that file:line combination),
or a column (all occurrences of that particular file:line:column).
Inlined positions are treated as a sequence of positions, not a single
position.
Prompts:
```
The file cmd/compile/internal/ir/dump.go contains a function AstDump
that calls FDump to generate a textual representation of the AST from
several phases within the compiler.
The file cmd/compile/internal/ir/fmt.go contains the definition of
FDump.
The SSA phases of the compiler use code in
cmd/compile/internal/ssa/html.go to render its textual representation
into an html display that allows hiding phases and highlighting blocks,
identifiers and line numbers.
Please write a similar HTML-generating phase for AST that produces an
output that will allow hiding phases and perhaps hiding subtrees, and
highlighting identifiers and line numbers. The idioms and hacks used
in the SSA html display have worked well, if you want to copy them.
```
```
Not bad, but the output contains a strike-through beginning on a line
that contains "TYPE type *testing.B tc(1)". The strike through
begins after "TYPE " and continues for the rest of the output. Can you
find that bug and fix it?
```
```
The AST output is often wider than the statically sized columns in the
HTML output. Either the columns need to have a width that can be
resized (dragged wider, for example) or the AST needs to be draggable,
side-to-side, within the columns. Resizable columns seems like the
preferable choice, if it is possible.
```
```
The highlighting for file name and line number is not quite right -- all
the lines in the same file are grouped together, where what I want, is
that each different file:line:column gets its own number. There's also
the issue of inlining, in some cases the location is described as more
than one file:line:column, where the first is the call site and the
second is the inlined function. I think it makes sense to treat each
single file:line:column as its own item for highlighting, instead of
trying to treat the sequence of file:line:column as a single distinct
location. One thing that might be interesting, but I am not sure how
hard it would be, is to distinguish between clicks to the file part,
the line part, and the column part -- click on file means highlight
all that matches file, click on line means all that machines file:line
(not just the line numner, since there may be different files, with
inlining) and click on the column means to highlight the specific
file:line:column triple. That is, if it is possible.
```
```
Lovely. Can you implement highlighting for names, strings
like "NAME-testing.b" so that all uses of a variable or a temporary can
easily be seen?
```
Change-Id: I1ed97cd92cdae16d556e3334e543af37973799e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/740563
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: t hepudds <thepudds1460@gmail.com> Reviewed-by: Keith Randall <khr@google.com>
Nicholas S. Husin [Mon, 2 Feb 2026 21:38:01 +0000 (16:38 -0500)]
net/http: prevent blocking when draining response body after it has been closed
Previously, draining the response body after it has been closed causes
Response.Body.Close to block for longer than it otherwise would. In a
worst-case scenario, this means that we are incurring a 50 ms delay for
each HTTP/1 request that we make.
This CL makes sure that a response body is drained asynchronously and
updates relevant documentations to reflect the current behavior.
For #77370
Change-Id: I2486961bc1ea3d43d727d0aabc7a6ca7dfb166ee
Reviewed-on: https://go-review.googlesource.com/c/go/+/741222 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
Michael Anthony Knyszek [Tue, 3 Feb 2026 15:45:21 +0000 (15:45 +0000)]
internal/runtime: fix assembly for spectre retpoline instrumentation
In the last year we added two CALLs whose targets are loaded from
memory. Change them to call from a register so that the instrumentation
for spectre mitigations works.
This change also adds a smoke test for the spectre build flags.
For #77420.
Change-Id: I35ec723449ff6a712bcce3276bf1df3fa932bddc
Cq-Include-Trybots: luci.golang.try:gotip-linux-amd64-longtest
Reviewed-on: https://go-review.googlesource.com/c/go/+/741541
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
Corentin Chary [Wed, 28 Jan 2026 21:17:38 +0000 (22:17 +0100)]
bytes, strings: replace asciiSet bitset with lookup table
Replace the 32-byte bitset implementation with a 256-byte lookup table
for simpler and faster ASCII character membership testing.
The bitset implementation used bit manipulation (shifts, masks, AND/OR)
requiring multiple CPU operations per lookup. The lookup table uses
direct array indexing with a single load and compare, reducing CPU
overhead significantly.
Using [256]bool instead of [256]byte allows the compiler to eliminate
the comparison instruction entirely, as bool values are guaranteed to be
either 0 or 1.
The full 256-element array (rather than 128 elements) is used because it
eliminates branches entirely. Testing shows [256]bool is 68% faster than
[128]bool with an explicit bounds check (488µs vs 821µs) due to avoiding
branch misprediction penalties in the hot path. Using [128]bool with bit
masking (c&0x7f) eliminates bounds checks but still costs ~10% performance
due to the AND operation.
The 224-byte increase in memory usage is acceptable for modern systems,
and the simpler implementation is easier to understand and maintain.
Full benchmark results demonstrating ~1.5x improvements across all
affected functions are available at:
https://github.com/golang/go/issues/77194#issuecomment-3814095806
This supersedes CL 737920 with a simpler approach that improves
performance for all architectures without requiring SIMD instructions.
Updates #77194
Change-Id: I272ee6de05b963a8efc62e7e8838735fb0c4f41b
Reviewed-on: https://go-review.googlesource.com/c/go/+/739982
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Filippo Valsorda [Fri, 30 Jan 2026 17:07:23 +0000 (18:07 +0100)]
crypto/tls: revalidate whole chain on resumption on Windows and macOS
TestHandshakeChangeRootCAsResumption and TestHandshakeGetConfigForClientDifferentClientCAs
changed because previously rootA and rootB shared Subject and SPKI,
which made the new full-chain revalidation check succeed, as the
same leaf would verify against both roots.
Fixes #77376
Cq-Include-Trybots: luci.golang.try:gotip-darwin-arm64-longtest
Change-Id: I60bed694bdc621c9e83f1bd8a8224c016a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/741361
Auto-Submit: Filippo Valsorda <filippo@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Roland Shoemaker <roland@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Roland Shoemaker <roland@golang.org>
Ian Lance Taylor [Fri, 30 Jan 2026 23:39:04 +0000 (15:39 -0800)]
compress/bzip2: use obscuretestdata.ReadFile to avoid creating temporary
The temporary was not being deleted. Not creating it at all is better.
Change-Id: Id9c5498a2f7d2f58770a09a2a76f4ab30943dd3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/740780 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net> Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Mark Freeman [Fri, 30 Jan 2026 19:23:02 +0000 (14:23 -0500)]
go/types, types2: add missing Named.unpack call in Checker.hasVarSize
CL 734980 swapped use of Type.Underlying() in Checker.hasVarSize for
traversal of Named.fromRHS. It forgot to call Named.unpack() before
inspecting Named.fromRHS, allowing access of unexpanded instantiated
types.
These unexpanded instantiated types are then mistakenly marked as having
fixed size, which fails assertions downstream. This change adds the
missing Named.unpack() call and swaps direct access of Named.fromRHS for
Named.rhs(), which verifies such access in debug mode.
Fixes #77382
Change-Id: I324bbbbf790f8b09e95902ebe67f775483f88417
Reviewed-on: https://go-review.googlesource.com/c/go/+/740620 Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
ArsenySamoylov [Tue, 13 Jan 2026 10:06:28 +0000 (13:06 +0300)]
internal/maps,cmd/compile/internal/walk: replace calls to mapaccess1* with mapaccess2*
mapaccess1* and mapaccess2* functions share the same implementation and differ only in whether the boolean "found" is returned.
This change replaces mapaccess1* calls with mapaccess2*.
We can do this transparently, since the call site can safely discard the second (boolean) result.
Ideally, mapacces1* functions could be removed entirely, but this change keeps them as thin wrappers for compatibility.
Fixes #73196
Change-Id: I07c3423d22ed1095ac3666d00e134c2747b2f9c1
Reviewed-on: https://go-review.googlesource.com/c/go/+/736020 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Joe Tsai [Fri, 30 Jan 2026 20:15:31 +0000 (12:15 -0800)]
encoding/json: use pooled encoder in Encoder.Encode
Due to the lack of MarshalWrite in the v1 API,
it is unfortunately common to see:
json.NewEncoder(out).Encode(in)
where a single-use Encoder is constructed and thrown away.
This performed acceptably in v1 since every call to Encode
used a globally pooled encoder resource.
Prior to this change, the v1-in-v2 implementation relied
on a bytes.Buffer cached only for the lifetime of the Encoder
object itself. Thus, a single-use Encoder does not benefit.
Modify the wrapper implementation to use the internal
pooled encoder from v2 and use the intermediate buffer
to write directly to the output io.Writer.
We assume that the user-provided io.Writer never leaks the buffer,
but this assumption was already held in the v1 implementation.
We are not increasing the surface area of data corruption risk.
Performance of v1 to v1-in-v2 (before the pool fix):
name old time/op new time/op delta
NewEncoderEncode-32 30.2ms ± 4% 28.3ms ± 9% -6.19% (p=0.002 n=9+10)
name old alloc/op new alloc/op delta
NewEncoderEncode-32 7.64MB ± 0% 28.37MB ± 0% +271.23% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
NewEncoderEncode-32 200k ± 0% 100k ± 0% -49.99% (p=0.000 n=9+10)
Interestingly, v1-in-2 is slightly faster,
but the amount of allocated memory is massive.
Performance of v1 to v1-in-v2 (after the pool fix):
name old time/op new time/op delta
NewEncoderEncode-32 30.2ms ± 4% 24.0ms ± 7% -20.36% (p=0.000 n=9+10)
name old alloc/op new alloc/op delta
NewEncoderEncode-32 7.64MB ± 0% 4.09MB ± 3% -46.52% (p=0.000 n=10+10)
name old allocs/op new allocs/op delta
NewEncoderEncode-32 200k ± 0% 100k ± 0% -50.00% (p=0.000 n=9+9)
Now, the v1-in-v2 implementation is better than v1 on all metrics.
Fixes #75026
Change-Id: I50c975b1d5b8da806e46bc627966b0a39c1817eb
Reviewed-on: https://go-review.googlesource.com/c/go/+/740660 Reviewed-by: Michael Pratt <mpratt@google.com> Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ian Lance Taylor [Fri, 30 Jan 2026 23:52:19 +0000 (15:52 -0800)]
cmd/cover, cmd/covdata: actually delete temp dirs
The code was using defer in TestMain, but was also calling os.Exit,
which meant that the deferred functions did not run.
TestMain does not require calling os.Exit, so stop doing it.
Change-Id: I25ca64c36acf65dae3dc3f46e5fa513b9460a8e9
Reviewed-on: https://go-review.googlesource.com/c/go/+/740781 Reviewed-by: Than McIntosh <thanm@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com>
Brad Fitzpatrick [Tue, 27 Jan 2026 17:05:48 +0000 (09:05 -0800)]
net: don't wait 5 seconds to re-read /etc/resolv.conf
If a Go process starts up, finds /etc/resolv.conf empty, then the DHCP
client writes /etc/resolv.conf, the Go program would find itself
broken for up to 5 seconds.
We noticed this during integration tests in ephemeral VMs using
gokrazy that boot into our application.
Change-Id: Ia64c2b5c698a4ee3efc15d8a8f1850c47e531b84
Reviewed-on: https://go-review.googlesource.com/c/go/+/739620 Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Nicholas S. Husin [Thu, 22 Jan 2026 03:46:21 +0000 (22:46 -0500)]
net/http: try to drain response body upon closing for better connection re-use
Currently, we have a rather inconsistent behavior in terms of whether a
connection can be re-used or not when an HTTP body is not read to
completion:
- In HTTP/2, not reading bodies to completion is not an issue, since a
new HTTP/2 stream can be created on the same TCP connection.
- In HTTP/1 server, we discard up to 256 KiB of unconsumed request body,
to potentially allow re-use.
- In HTTP/1 client, we do not do anything, and fail to re-use a TCP
connection if there are any unconsumed response body at all.
This has led to some confusion. For example, some users have mistakenly
discarded response body for HTTP/2 when doing so is not needed. Manually
discarding response body can also be disadvantageous if the body is
excessively large or is a never-ending stream.
To solve this issue, this CL makes it so that closing a response body
will cause any remaining content to be drained, up to a limit of 256 KiB
or 50 milliseconds, whichever one is reached first. This allows better
connection re-use for HTTP/1, and most users can now avoid having to
manually drain their response body.
For #77370
Change-Id: I71e1227fc9cf5f901362c8e234320817f6b0be24
Reviewed-on: https://go-review.googlesource.com/c/go/+/737720 Reviewed-by: Nicholas Husin <husin@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Damien Neil <dneil@google.com>
thepudds [Wed, 21 Jun 2023 17:27:11 +0000 (13:27 -0400)]
fmt: avoid storing input arguments on pp to help escape analysis
This is part of a series of CLs that aim to reduce how often
interface arguments escape for the print functions in fmt,
such as val here:
func f(val int) {
fmt.Sprintf("%d", val)
}
Prior to this change, arguments immediately escape in doPrintf
because they are stored on the *pp in printArg:
parameter a leaks to <heap> for (*pp).doPrintf with derefs=1:
flow: <heap> ← *a:
from a[argNum] (dot of pointer) at .\print.go:1077:18
from (*pp).printArg(p, a[argNum], rune(c)) (call parameter) at .\print.go:1077:16
parameter arg leaks to <heap> for (*pp).printArg with derefs=0:
flow: <heap> ← arg:
from p.arg = arg (assign) at .\print.go:682:8
The *pp is heap allocated, and the heap cannot point to stack
variables, so the arguments currently cannot be on the stack.
This change instead threads through the input arguments as individual
type any and reflect.Value parameters, rather than storing on the *pp.
After this change, input arguments still escape, but now for
other reasons.
Updates #8618
Updates #62653
Change-Id: I81984daeceb761ce4ce269b150b888950ce2c5d4
Reviewed-on: https://go-review.googlesource.com/c/go/+/524938 Reviewed-by: Damien Neil <dneil@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Vasily Leonenko [Thu, 29 Jan 2026 18:12:49 +0000 (21:12 +0300)]
runtime: align end of systemstack_switch prologue on amd64 for consistency with gosave_systemstack_switch
gosave_systemstack_switch saves PC with fixed offset of 8 bytes from systemstack_switch to bypass prologue.
This commit makes this offset consistent with actual address of UNDEF instruction intended to be at that address.
Fixes #71440
Change-Id: Ibe6458c5bcb0bdaec228a2f13d6aec7ecc0e319e
Reviewed-on: https://go-review.googlesource.com/c/go/+/740360
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Paul Murphy [Wed, 7 Jan 2026 19:48:53 +0000 (13:48 -0600)]
all: switch linux-ppc64 target to ELFv2 ABI
Go is only capable of producing internally linked, static binaries
on linux-ppc64. As such, binaries should run in either ELFv1 or
ELFv2 ppc64 userspaces today.
This opens the door to enabling cgo and external linking which
will require ELFv2 support and userspace, eventually.
Fixes #76244
Change-Id: I5ca15037cbe546f352e8693dcf14da51a308b8ca
Reviewed-on: https://go-review.googlesource.com/c/go/+/734540
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>
This commit adds two test functions, bitsOptXor1 and bitsOptXor2,
to verify that the compiler correctly optimizes certain bitwise
expression patterns in future CLs.
Change-Id: Idf5bd1ff8653f8fa218604d857639e063546d8e7
Reviewed-on: https://go-review.googlesource.com/c/go/+/736540 Reviewed-by: Carlos Amedee <carlos@golang.org> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
I suspect it is because the temps are by default declared
outside the loop body, which escape analysis will determine is
an escaping value and result in a heap allocation. (I've seen
this problem before, including in my older CL 546023 that attempts
to help PGO with a similar issue.)
This is an attempt to address that by placing ODCLs within the
b.Loop body for the temps that are created so that they can be
marked keepalive.
There are two cases handled in the CL: function return values
and function arguments. The first case is what affects my example
from #73137, and is also illustrated via the NewX test case in
the new test/escape_bloop.go file.
Without this CL, the NewX call in the BenchmarkBloop test is inlined,
which is an improvement over Go 1.25, but the slice still escapes
because the temporary used for the return value is declared outside
the loop body.
With this CL, the slice does not escape.
The second case is illustrated via the new BenchmarkBLoopFunctionArg
test, which shows a function argument that escapes without this CL
but does not escape with this CL.
We can also make the two new b.Loop tests in testing/benchmark_test.go
individually pass or fail as expected based on individually
reverting the two changes in this CL.
While we are here, we add a note to typecheck.TempAt to help
make people aware of this behavior.
Updates #73137
Fixes #77339
Change-Id: I69abe978367a8d3a931430aec5d85c9c54b42c1f
Reviewed-on: https://go-review.googlesource.com/c/go/+/738822
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Ian Lance Taylor [Thu, 29 Jan 2026 22:50:05 +0000 (14:50 -0800)]
cmd/link: put type:* at the start of the type descriptors
That used to happen naturally because the symbol had zero size.
After CL 724261 we need to force it.
Fixes #77372
Change-Id: Ia8eef989bc9cbad5459b60ff6535136e7e0c6cab
Reviewed-on: https://go-review.googlesource.com/c/go/+/740400 Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Ian Lance Taylor <iant@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>
Jonah Uellenberg [Thu, 29 Jan 2026 19:45:27 +0000 (19:45 +0000)]
cmd/compile: make prove use non-equality in subtraction for a stronger bound
Given:
s := /* slice */
k := /* proved valid index in s (0 <= k < len(s)) */
v := s[k:]
len(v) >= 1, so v[0] needs no bounds check. However, for
len(v) = len(s) - k, we only checked if len(s) >= k and so could only
prove len(v) >= 0, thus the bounds check wasn't removed.
As far as I can tell these checks were commented out for performance,
but after benchmarking prove I see no difference.
Fixes: #76429
Change-Id: I39ba2a18cbabc0559924d4d226dcb99dbe9a06ed
GitHub-Last-Rev: 53f3344d261986cd021c8d7b8435ab89b5438b8f
GitHub-Pull-Request: golang/go#76609
Reviewed-on: https://go-review.googlesource.com/c/go/+/725100 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Ian Lance Taylor [Thu, 29 Jan 2026 08:51:32 +0000 (00:51 -0800)]
cmd/link: remove AIX special case for first type descriptor
It doesn't seem to be necessary, and removing it seems cleaner
than adding an AIX case to the code in runtime.moduleTypelinks.
Fixes #77365
Change-Id: I59fa56abf42e18017bd112481ea09d0cca47d105
Reviewed-on: https://go-review.googlesource.com/c/go/+/740220 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
Mateusz Poliwczak [Fri, 23 Jan 2026 15:12:27 +0000 (16:12 +0100)]
go/token: simplify fixOffset
Each time I go to definition of this I am deeply confused
at what I am looking, so let's clean this a bit with modern Go.
Change-Id: I8f44e78f0cdde9b970388f9b98a2720e6a6a6964
Reviewed-on: https://go-review.googlesource.com/c/go/+/738341
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Alan Donovan <adonovan@google.com>
Ian Lance Taylor [Thu, 29 Jan 2026 07:28:09 +0000 (23:28 -0800)]
cmd/link: adjust symkind comparisons in XCOFF code
This XCOFF symkind comparison broke when STYPE moved in CL 723580.
These comparisons are unmaintainable, but at least the new code
is no worse than the old code.
Change-Id: I1be9de6afdf1814aaadcd2105e6247a4b66b46fe
Reviewed-on: https://go-review.googlesource.com/c/go/+/740200
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>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Guoqi Chen [Thu, 29 Jan 2026 15:26:09 +0000 (23:26 +0800)]
cmd/compile: update ABI document for loong64
The duff device has been dropped on loong64,
now we can remove related documentation.
Change-Id: I0bd721adc227522ae3c56dfe199ef735cfdf5d33
Reviewed-on: https://go-review.googlesource.com/c/go/+/740260
Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org>
Keith Randall [Wed, 28 Jan 2026 23:39:46 +0000 (15:39 -0800)]
runtime: use smaller max align for arm32
Maybe fixes a dashboard build failure for linux/arm32 casued
by CL 724261.
This value comes from cmd/link/internal/arm/l.go (and in general,
maxAlign in cmd/link/internal/$ARCH/<something>.go).
Change-Id: I4d02cd41072da1b6ad6c7405044bd7788626b013
Reviewed-on: https://go-review.googlesource.com/c/go/+/740101
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Ian Lance Taylor <iant@golang.org>
Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Amol Yadav [Wed, 28 Jan 2026 01:14:53 +0000 (01:14 +0000)]
runtime/metrics: fix panic in Read with empty slice
Calling Read with a nil or empty slice previously caused a panic with
"index out of range" because the function unconditionally accessed the
first element of the slice (via &m[0]) to pass the pointer to the
runtime.
This change adds a check for len(m) == 0 to return early, preventing
the panic when no samples are provided.
Fixes #77231
Change-Id: I442635f5c61de432883c8d0efae9cc6aa1363cc9
GitHub-Last-Rev: 6f24f67b18c77a0b36b92017a3f4ef8aa3aa5229
GitHub-Pull-Request: golang/go#77233
Reviewed-on: https://go-review.googlesource.com/c/go/+/737380 Reviewed-by: Amol Yadav <amolyadav6125@gmail.com> Reviewed-by: Michael Pratt <mpratt@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
Commit-Queue: Michael Pratt <mpratt@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Roland Shoemaker [Mon, 26 Jan 2026 19:18:45 +0000 (11:18 -0800)]
crypto/tls: check verifiedChains roots when resuming sessions
When resuming TLS sessions, on the server and client verify that the
chains stored in the session state (verifiedChains) are still acceptable
with regards to the Config by checking for the inclusion of the root in
either ClientCAs (server) or RootCAs (client). This prevents resuming
a session with a certificate chain that would be rejected during a full
handshake due to an untrusted root.
Roland Shoemaker [Mon, 26 Jan 2026 18:55:32 +0000 (10:55 -0800)]
crypto/tls: add verifiedChains expiration checking during resumption
When resuming a session, check that the verifiedChains contain at least
one chain that is still valid at the time of resumption. If not, trigger
a new handshake.
Guoqi Chen [Thu, 22 Jan 2026 02:44:19 +0000 (10:44 +0800)]
cmd/compile: simplify slice/array range loops on loong64
loong64 supports R+R addressing ({st,ld}x.{b,h,w,d} instructions)
and has implemented the relevant lowering rules (only width is 1).
Removes 1616 instructions from the go binary on loong64.
file before after Δ %
asm 575366 575314 -52 -0.0090%
cgo 489972 489884 -88 -0.0180%
compile 29204182920110 -308 -0.0105%
cover 540458 540290 -168 -0.0311%
fix 865840 865668 -172 -0.0199%
link 732858 732662 -196 -0.0267%
preprofile 246022 245978 -44 -0.0179%
vet 839268 839124 -144 -0.0172%
go 16664701666114 -356 -0.0214%
gofmt 326526 326438 -88 -0.0270%
total 92031989201582 -1616 -0.0176%
Change-Id: If3518547c785764877a6cf987781d43d8b572990
Reviewed-on: https://go-review.googlesource.com/c/go/+/738240 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>
Change-Id: I6562e72bc233a45dc7b02f75f68020831ad399ea
Reviewed-on: https://go-review.googlesource.com/c/go/+/739680
Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Ian Lance Taylor [Wed, 26 Nov 2025 06:44:11 +0000 (22:44 -0800)]
cmd/link, runtime: remove typelinks
Instead of adding a typelinks section to a Go binary,
mark the start and end of the typelinked type descriptors.
The runtime can then step through the descriptors to find them all,
rather than relying on the extra linker-generated offset list.
The runtime steps through the type descriptors lazily,
as many Go programs don't need the typelinks list at all.
This reduces the size of cmd/go by 15K bytes, which isn't much
but it's not nothing.
A future CL will change the reflect package to use the type pointers
directly rather than converting to offsets and then back to type pointers.
For #6853
Change-Id: Id0af4ce81c5b1cea899fc92b6ff9d2db8ce4c267
Reviewed-on: https://go-review.googlesource.com/c/go/+/724261 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>