runtime: preserve recover error values#1882
Conversation
|
CI note: normal PR CI is running from the fork branch I attempted to dispatch the manual-only I also attempted to dispatch Per branch policy, I did not push an upstream |
699e9cf to
82b8a1a
Compare
|
Updated PR after rebasing onto current Additional tests run locally:
The earlier Ubuntu |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
|
Update from commit 6b65c2c:\n\n- Fixed direct vs indirect recover scoping and nested panic stack handling; removed the recover1.go xfail entries covered by this PR.\n- Kept recover.go xfails: the remaining failure is reflect/interface type identity in test9reflect2, not the recover/defer panic root.\n- Kept recover4.go xfails: SIGBUS is now routed to the panic path, but the remaining mismatch is stale local/named-result state after fault recovery (memcopy returned 0 vs 131067), which I am not mixing into this recover/defer PR.\n- Kept deferprint.go and fixedbugs/bug409.go xfails: remaining mismatches are float print exponent formatting (+e+00 vs +e+000).\n\nLocal validation:\n- go test ./test/go -count=1\n- go test ./test/goroot -count=1 -run TestGoRootRunCases -args -goroot |
|
Update after 77ceb09:
Focused tests passed locally: test/go recover cases via Go and llgo, recover4.go goroot with and without xfail, recover.go goroot with retained xfail, go test ./test/go, go test ./ssa, go test ./cl, and runtime/internal/runtime inside the runtime module. |
|
Update for commit
Focused checks passed:
Known unrelated non-covered check: |
|
Update for
Local validation:
|
|
Resolved the latest merge conflict with xgo-dev/main (51d665e). Kept recover1.go/recover4.go out of xfail for this PR's recovered panic value fix, while preserving unrelated main xfails such as issue73917/issue73920.\n\nLocal verification:\n- go test -timeout 20m ./test/go -run 'Test(Recover|RuntimeError|Panic|GenericUnsafeSizeofArithmetic)' -count=1\n- go test -timeout 20m ./test/goroot -run TestGoRootRunCases -count=1 -args -goroot /Users/lijie/sdk/go1.26.0 -case '^(recover1|recover4).go$' -run-timeout 60s\n- git diff --check |
|
Update for
Local validation:
Also checked broader local package runs. They still hit pre-existing, unrelated failures that I did not change in this recover/panic PR: CI and Codecov are expected to rerun from the fork branch after this push. |
|
Updated the stale FileCheck expectation in cl/_testdata/vargs/in.go from AssertIndexRange(i1) to the current CheckIndexRange(i1, i64, i1, i64) IR emitted by litgen. Local verification passed:
The remaining public test/go print failure is still tracked separately in #1945 and was not changed here. |
5a10a71 to
f7ea6d7
Compare
5c0bf1f to
f29c5d6
Compare
17cfabb to
5bb0176
Compare
-depths generates deep_<N> scenarios at configurable call depths; -bigsizes generates bigfunc scenarios (funcs x statements) whose large bodies stress statement-level pcline density, mid-function pc symbolization, and ordinary performance of big method bodies. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
5bb0176 to
bd1d08c
Compare
|
Rebased onto #2016 ( |
|
Superseded by #2034, which re-expresses the recover-error-value semantics (real runtime.TypeAssertionError values, SIGBUS fault path, recover2/4 + zerodivide + issue73917/73920 conformance) on top of #2033's Defer-node model; the funcinfo draft carried here was superseded by #2012/#2016/#2019. The recursive-panic sub-call masking piece (recover1.go) is tracked as a #2033-model follow-up. |
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
…s; recover conformance Re-expresses the surviving value of xgo-dev#1882 on top of xgo-dev#2033 (its remaining ~11k diff lines were the pre-xgo-dev#2012 funcinfo draft, superseded): - Failed (non-comma-ok) type assertions panic with a real *runtime.TypeAssertionError built at runtime (TypeAssertError + missing-method lookup from abi tables) instead of a plain errorString; the recovered value implements runtime.Error, matching gc. The source-interface abi type is deliberately not materialized at the assert site: doing so can reference another package's private local-generic symbols (undefined at link); the message's interface name is the documented mdempsky/16 residual. - SIGBUS joins SIGSEGV in the fault-to-panic signal path (per-OS signal constants; darwin/linux). - goroot xfails retired, validated darwin go1.26 + go1.24: recover2.go, recover4.go, zerodivide.go, fixedbugs/issue73917.go, issue73920.go. - recover1.go stays xfailed with an updated reason (recursive-panic sub-call recover masking - Defer-node model follow-up); three ported tests covering the same class are t.Skip'ed with that pointer. - Golden CHECK updates: assert-failure sites now emit TypeAssertError+Panic; constants renumbered from actual IR. Supersedes xgo-dev#1882.
Summary
recover()values assert toerrorandruntime.Error.TypeAssertionErrorvalues for compiler-generated failed type assertions, and fix slice-to-array conversion panic bounds order.recoversemantics through compiler-generated method wrappers when the wrapper is itself the deferred call, while keeping nested wrapper calls non-recovering.fixedbugs/issue73917.goandfixedbugs/issue73920.go: a recover in a real helper call reached through deferred promoted wrappers remains indirect, and the outer deferred recover still sees the panic.longjmprecovery by emitting volatile loads/stores for local SSA allocs in functions with recover blocks.test/gocoverage for recovered runtime errors, type assertion panic values, method-wrapper recover semantics, embedded wrapper function-pointer recover semantics, and fault recovery preserving named results; remove the now-passingrecover2.go,zerodivide.go,recover4.go,fixedbugs/issue73917.go, andfixedbugs/issue73920.goGOROOT xfails.Still XFail / Out of Scope
recover.goremains xfail in this PR. On this branch it still fails before the recover-10 path with the ssa: panic with runtime type assertion errors #1892 interface type identity issue:interface conversion: interface {} is func(*main.T1), not func(*main.T1) (types from different scopes).missing recover 10is covered independently bytest/go.test/gocases are Go 1.26+ semantic coverage. Go 1.24 has pre-Go 1.26 behavior for the upstreamissue73917.go/issue73920.goprograms, so those local tests skip under Go <1.26.test/gocurrently hits unrelated nil/range behavior inTestRangeOverNilArrayPointerCallIsEvaluated; this PR intentionally does not cover nil/range, chan, print, interface, reflect, GC, liveness, finalizer, or goroutine domains.Testing
go test ./test/go -run 'TestRecoverThrough|TestRecoverAfterFault' -count=1go run ./cmd/llgo test -run 'TestRecoverThrough|TestRecoverAfterFault' -count=1 ./test/gogo test ./test/goroot -run TestGoRootRunCases/recover4.go -count=1 -args -goroot "$(go env GOROOT)" -dirs . -case '^recover4\.go$' -xfail /tmp/llgo-empty-xfail.yamlgo test ./test/goroot -run TestGoRootRunCases/recover4.go -count=1 -args -goroot "$(go env GOROOT)" -dirs . -case '^recover4\.go$'go test ./test/goroot -run TestGoRootRunCases/recover.go -count=1 -args -goroot "$(go env GOROOT)" -dirs . -case '^recover\.go$'(passes via retained xfail)go test ./test/goroot -run TestGoRootRunCases/recover.go -count=1 -args -goroot "$(go env GOROOT)" -dirs . -case '^recover\.go$' -xfail /tmp/llgo-empty-xfail.yaml(expected failure: ssa: panic with runtime type assertion errors #1892 interface type identity blocker)go test ./test/go -run 'TestDeferredEmbedded.*MethodWrapperKeepsIndirectRecoverNil|TestRecoverThrough' -count=1/Users/lijie/sdk/go1.26.0/bin/go test ./test/go -run 'TestDeferredEmbedded.*MethodWrapperKeepsIndirectRecoverNil' -count=1 -v/Users/lijie/sdk/go1.26.0/bin/go run ./cmd/llgo test -run 'TestDeferredEmbedded.*MethodWrapperKeepsIndirectRecoverNil|TestRecoverThrough' -count=1 ./test/gogo test ./test/goroot -run TestGoRootRunCases -count=1 -args -goroot /Users/lijie/sdk/go1.26.0 -dirs fixedbugs -case '^fixedbugs/issue739(17|20)\.go$'go test ./test/go -count=1(cd runtime && go test ./internal/runtime -count=1)go test ./ssa -count=1go test ./cl -count=1/Users/lijie/sdk/go1.26.0/bin/go test ./test/go -count=1(known unrelated failure:TestRangeOverNilArrayPointerCallIsEvaluatednil array pointer range SIGSEGV)GOROOT CI
Full GOROOT CI is disabled/too slow for regular PR validation in this repo and the
GOROOTworkflow is manual-only. This PR keeps stable coverage intest/goand lists the exact targeted GOROOT commands above. I will monitor the available PR checks after pushing the fork head branch; I will not push branches toxgo-dev/llgo.