Skip to content

runtime: tighten recover to direct deferred calls#1918

Draft
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-fixedbugs-recover-coverage
Draft

runtime: tighten recover to direct deferred calls#1918
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-fixedbugs-recover-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 24, 2026

This fixes the fixedbugs recover/defer group by making recover succeed only when called directly by the deferred function currently being run.

Changes:

  • track panic values as a stack and gate Recover with a deferred-function token
  • avoid broad recover-frame instrumentation for defers that cannot directly recover
  • preserve named return values across recover with volatile stack slots for recover-capable functions
  • add stable coverage under test/go for issue4066, direct deferred func values, and Go 1.26 issue73916/issue73916b semantics
  • remove verified xfail entries for fixedbugs/issue4066.go, fixedbugs/issue73916.go, fixedbugs/issue73916b.go

Local verification:

  • go test ./test/go -count=1
  • go test ./ssa -count=1
  • go test ./cl -count=1
  • /opt/homebrew/Cellar/go/1.26.0/libexec/bin/go test ./test/goroot -v -run TestGoRootRunCases -count=1 -goroot /opt/homebrew/Cellar/go/1.26.0/libexec -case 'fixedbugs/issue(4066|73916|73916b)\.go' -directive-mode=runlike -xfail \n- go1.24 GOROOT TestGoRootRunCases fixedbugs/issue4066.go with empty xfail\n\nNote: GC/liveness/finalizer/goroutine cases are intentionally untouched.

@cpunion cpunion force-pushed the codex/goroot-fixedbugs-recover-coverage branch from 6de90d9 to ad13f0e Compare May 24, 2026 12:52
@codecov-commenter
Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 93.04813% with 13 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
ssa/eh.go 84.37% 9 Missing and 1 partial ⚠️
cl/compile.go 95.74% 1 Missing and 1 partial ⚠️
cl/instr.go 97.22% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants