0
1
mirror of https://github.com/golang/go synced 2025-02-23 03:56:14 +00:00
go/test/fixedbugs
David Chase af236716b2 [release-branch.go1.24] cmd/compile, runtime: use deferreturn as target PC for recover from deferrangefunc
The existing code for recover from deferrangefunc was broken in
several ways.

1. the code following a deferrangefunc call did not check the return
value for an out-of-band value indicating "return now" (i.e., recover
was called)

2. the returned value was delivered using a bespoke ABI that happened
to match on register-ABI platforms, but not on older stack-based
ABI.

3. the returned value was the wrong width (1 word versus 2) and
type/value(integer 1, not a pointer to anything) for deferrangefunc's
any-typed return value (in practice, the OOB value check could catch
this, but still, it's sketchy).

This -- using the deferreturn lookup method already in place for
open-coded defers -- turned out to be a much-less-ugly way of
obtaining the desired transfer of control for recover().

TODO: we also could do this for regular defer, and delete some code.

Fixes #71840

Change-Id: If7d7ea789ad4320821aab3b443759a7d71647ff0
Reviewed-on: https://go-review.googlesource.com/c/go/+/650476
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-on: https://go-review.googlesource.com/c/go/+/651497
2025-02-21 18:58:02 -08:00
..
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2023-03-28 18:13:13 +00:00
2022-05-18 00:47:29 +00:00
2023-03-28 18:13:13 +00:00
2018-10-18 04:57:41 +00:00
2017-09-19 18:08:50 +00:00
2016-04-25 19:20:40 +00:00
2016-05-08 22:59:43 +00:00
2017-09-15 02:39:16 +00:00
2016-09-04 00:15:41 +00:00
2016-12-08 23:22:37 +00:00
2021-02-22 22:53:51 +00:00
2016-10-12 14:57:26 +00:00
2017-05-18 21:33:05 +00:00
2023-04-11 20:56:32 +00:00
2021-04-21 20:24:34 +00:00
2024-09-13 21:21:33 +00:00
2017-09-08 20:10:48 +00:00
2017-09-08 20:10:48 +00:00
2024-09-13 21:24:10 +00:00
2019-04-24 19:55:13 +00:00
2019-07-18 11:34:23 +00:00
2019-07-18 17:24:59 +00:00
2021-02-22 20:00:00 +00:00
2020-11-21 16:46:05 +00:00
2021-05-22 00:51:17 +00:00
2023-02-07 20:59:40 +00:00
2024-10-14 19:58:47 +00:00