Skip to content

runtime: short-circuit struct equality before string bodies#1895

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

runtime: short-circuit struct equality before string bodies#1895
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-mapcmp-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 22, 2026

Summary

  • Add a cheap, panic-order-preserving mismatch pass for runtime struct equality so scalar fields and string lengths can reject unequal values before string body comparison.
  • Add test/go coverage for protected-string interface struct comparisons and interface panic ordering.
  • Remove fixed fixedbugs/issue8606b.go GOROOT xfail entries.

GOROOT CI note

Full GOROOT runs are slow/disabled for this slice. This PR uses targeted test/goroot runs with the current machine GOROOT (go env GOROOT = /opt/homebrew/Cellar/go@1.24/1.24.11/libexec) and relies on normal PR CI from the fork branch. No branch was pushed to xgo-dev/llgo; if manual GOROOT workflow_dispatch cannot resolve fork refs, that should be documented rather than pushing to xgo-dev.

Test coverage

New stable coverage is in test/go/interface_string_compare_test.go for the fixed string/interface comparison behavior.

Targeted commands

  • Reproduced before fix: go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 10m -args -goroot $(go env GOROOT) -dirs fixedbugs -case "^fixedbugs/issue8606b\.go$" -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 30s (failed: llgo signal exit, go exit 0)
  • go test ./test/go -run "TestInterfaceStruct(StringCompareShortCircuits|ComparePreservesInterfacePanicOrder)" -count=1
  • go run ./cmd/llgo test -run "TestInterfaceStruct(StringCompareShortCircuits|ComparePreservesInterfacePanicOrder)" -count=1 ./test/go
  • go test ./ssa -run TestBinOp -count=1
  • go test ./cl -run TestDoesNotExist -count=1
  • (cd runtime && go test ./internal/runtime -run TestDoesNotExist -count=1)
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 10m -args -goroot $(go env GOROOT) -dirs fixedbugs -case "^fixedbugs/issue8606b\.go$" -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 30s
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -timeout 10m -args -goroot $(go env GOROOT) -dirs fixedbugs -case "^fixedbugs/issue8606b\.go$" -run-timeout 30s

Residual risk

Linux GOROOT entries were removed because they are the same runtime equality root cause, but Linux GOROOT was not run locally on this darwin/arm64 host.

@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