Skip to content

fix bounds panic messages#1901

Draft
cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-boundsmsg-coverage
Draft

fix bounds panic messages#1901
cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-boundsmsg-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 22, 2026

Summary

  • preserve failing bounds operands and signedness in generated bounds checks
  • route slice/string bounds failures through runtime boundsError messages with len/cap-specific codes
  • add stable test/go coverage for bounds panic text and un-xfail fixed GOROOT issue30116 cases

GOROOT note

Full GOROOT CI is slow/disabled locally, so I ran targeted fixedbugs cases only. Machine GOROOT: /opt/homebrew/Cellar/go@1.24/1.24.11/libexec (go1.24.11 darwin/arm64). Normal PR CI should run from the fork branch.

Test/go coverage

Added test/go/bounds_panic_text_test.go covering runtime.Error panic text for signed/unsigned index checks, slice/string/array slicing, len vs capacity wording, and full slice max bounds.

Targeted commands run

  • go test ./test/go -run TestBoundsPanicText -count=1 -v
  • go test ./test/go -run 'Test(BoundsPanicText|UnsignedIndexBoundsCheck|FullSliceBoundsPanicText)' -count=1 -v\n- go run ./cmd/llgo test -run TestBoundsPanicText -count=1 ./test/go\n- go run ./cmd/llgo test -run 'Test(BoundsPanicText|UnsignedIndexBoundsCheck|FullSliceBoundsPanicText)' -count=1 ./test/go\n- go test ./ssa -run 'TestFromTestdata/utf8|TestFromTestgo/cursor' -count=1\n- go test ./ssa -run Test -count=1\n- go test ./cl -run 'TestRunAndTestFrom(Testgo|Testrt|Testdata|Testlibc)' -count=1\n- go test ./test/goroot -run TestGoRootRunCases -count=1 -v -args -goroot "$(go env GOROOT)" -dirs fixedbugs -case '^fixedbugs/issue30116(u)?\.go$' -xfail /tmp/llgo-no-xfail.yaml -run-timeout 5m -build-timeout 3m\n- go test ./test/goroot -run TestGoRootRunCases -count=1 -v -args -goroot "$(go env GOROOT)" -dirs fixedbugs -case '^fixedbugs/issue30116(u)?\.go$' -run-timeout 5m -build-timeout 3m\n\n## Local note\nA direct go test ./runtime/internal/runtime -count=1 is not applicable in this module layout; that runtime path is validated through LLGo test/go, SSA/CL checks, and the targeted GOROOT run.

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 22, 2026

PR #1901 follow-up for head b072c41.

Root cause: the failing test (ubuntu-latest, 19) job failed in cl at TestRunAndTestFromTestlibgo/mapzero. The runtime/compiler change now reports the precise Go-style bounds panic runtime error: index out of range [0] with length 0, but cl/_testlibgo/mapzero/expect.txt still expected the old shorter runtime error: index out of range.

Fix: updated the mapzero golden output to match the new bounds panic message. The functional bounds-message coverage remains in test/go/bounds_panic_text_test.go.

Local tests run:

  • go test ./test/go -run TestBoundsPanicText -count=1
  • go test ./cl -run 'TestRunAndTestFromTestlibgo/mapzero' -count=1\n- go test ./test/go -count=1\n- go test ./ssa -run 'Test.*' -count=1\n- go test ./cl -run TestRunAndTestFromTestlibgo -count=1\n\nCI status: new head checks have started and are currently pending/queued; I am monitoring run set for b072c41.

@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

✅ All modified and coverable lines are covered by tests.

📢 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