Skip to content

runtime: match legacy complex print exponents#1889

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

runtime: match legacy complex print exponents#1889
cpunion wants to merge 2 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-numeric-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 22, 2026

Summary

  • pad legacy builtin print %e exponents to Go's three-digit width so complex print output matches Go 1.24/1.25
  • add focused test/go coverage for constant, argument, and variable complex builtin printing
  • remove the now-fixed ken/cplx0.go GOROOT xfails for Go 1.24/1.25 on darwin/arm64 and linux/amd64

Validation

  • go test ./test/go -count=1 -run 'TestBuiltinPrintComplexLegacy'\n- go run ./cmd/llgo test -run 'TestBuiltinPrintComplexLegacy' -count=1 test/go/print_builtin_legacy_test.go\n- (cd runtime && go test ./internal/runtime -count=1)\n- go test ./test/goroot -count=1 -run TestGoRootRunCases -args -goroot "$(go env GOROOT)" -dirs ken -case '^ken/cplx0\\.go$' -xfail /tmp/llgo-empty-xfail-numeric.yaml\n\nGOROOT CI is slow/disabled, so this PR relies on targeted GOROOT reproduction plus stable test/go coverage. Normal PR CI should run from the fork branch.\n\n## Notes\n- A package-wide go run ./cmd/llgo test -run 'TestBuiltinPrintComplexLegacy' -count=1 ./test/go attempt currently links an unrelated existing generic_local_types_test.go symbol failure on this darwin/arm64 machine; the new file-level test above passes.

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 22, 2026

Update for c3d53852dae9e6e54f0026fa1929df41f7f34e64:

Root cause:

  • The previous patch wrapped legacy formatFloat with padLegacyPrintExponent, widening C %+.6e output from e+00 to e+000 for every legacy float print path.
  • formatComplex formats real/imag through formatFloat, so the same widening also changed complex output and caused the alias, invoke, multiret, struczero, _testrt/complex, and cpkgimp golden mismatches.

Fix:

  • Removed the legacy exponent padding so PrintFloat and PrintComplex keep the two-digit exponent form expected by the existing cl golden tests.
  • Reworked test/go/print_builtin_legacy_test.go to execute an actual llgo run probe covering float and complex builtin print output, instead of only checking the host Go test binary. The test filters known linker warning noise before comparing stderr.

Local testing:

  • go test ./test/go -run TestBuiltinPrintLegacyExponentWidth -count=1 -v
  • go test ./cl -run 'TestRunAndTestFromTestgo/(alias|invoke|multiret|struczero)$' -count=1 -v\n- go test ./cl -run 'TestRunAndTestFromTestrt/complex$' -count=1 -v\n- go test ./cl -run 'TestRunAndTestFromTestdata/cpkgimp$' -count=1 -v\n- go test ./test/go -count=1\n- go test ./ssa -count=1\n- go test ./cl -count=1\n\nPushed only to origin codex/goroot-numeric-coverage. PR remains draft; new head CI is queued/in progress.

@cpunion
Copy link
Copy Markdown
Collaborator Author

cpunion commented May 22, 2026

CI update for c3d53852dae9e6e54f0026fa1929df41f7f34e64:

  • test (ubuntu-latest, 19) passed.
  • llgo (ubuntu-latest, 19) passed.
  • llgo (ubuntu-latest, 19, 1.21.13), 1.24.2, and 1.26.0 passed.
  • All currently completed Ubuntu LLGo test shards passed.
  • No new failures observed so far. macOS and release jobs are still pending/queued on runners.

@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