]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: prevent compiling closures more than once
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Fri, 22 Oct 2021 10:05:35 +0000 (17:05 +0700)
committerCuong Manh Le <cuong.manhle.vn@gmail.com>
Sat, 23 Oct 2021 06:36:16 +0000 (06:36 +0000)
commit85d2751d2ea38b10127df0b27d04b1a26f54bcfa
tree5a939ecc310b39dc319a6b481c3775ea47d84b48
parent6c200017bf0ad9987453d5c265e5a3063ad72dc5
cmd/compile: prevent compiling closures more than once

Since CL 282892, functions are always compiled before closures. To do
that, when walking the closure, it is added to its outer function queue
for scheduling compilation later. Thus, a closure may be added to queue
more than once, causing the ICE dues to being compiled twice.

To fix this, catching the re-walking of the closure expression and do
not add it to the compilation queue.

Fixes #49029

Change-Id: I7d188e8f5b4d5c4248a0d8e6389da26f1084e464
Reviewed-on: https://go-review.googlesource.com/c/go/+/357960
Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
src/cmd/compile/internal/walk/closure.go
test/fixedbugs/issue49029.go [new file with mode: 0644]