]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.24] cmd/compile: avoid infinite recursion when inlining closures
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 14 Feb 2025 20:00:27 +0000 (03:00 +0700)
committerMichael Knyszek <mknyszek@google.com>
Wed, 19 Feb 2025 21:49:27 +0000 (13:49 -0800)
commiteb58df7dbfcd8834c956f2ef52020c017ed5630b
tree069b6255f6cbeaeb03eb3f0b49f07afc593e5d0e
parent30f4d9e117ba66f77bf9dc507da4ad35c747d0cb
[release-branch.go1.24] cmd/compile: avoid infinite recursion when inlining closures

CL 630696 changes budget for once-called closures, making them more
inlinable. However, when recursive inlining involve both the closure and
its parent, the inliner goes into an infinite loop:

parent (a closure)  -> closure -> parent -> ...

The problem here dues to the closure name mangling, causing the inlined
checking condition failed, since the closure name affects how the
linker symbol generated.

To fix this, just prevent the closure from inlining its parent into
itself, avoid the infinite inlining loop.

Fixes #71829

Change-Id: Ib27626d70f95e5f1c24a3eb1c8e6c3443b7d90c8
Reviewed-on: https://go-review.googlesource.com/c/go/+/649656
Reviewed-by: David Chase <drchase@google.com>
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: Michael Knyszek <mknyszek@google.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/650555
src/cmd/compile/internal/inline/inl.go
test/fixedbugs/issue71680.go [new file with mode: 0644]