Skip to content

test/goroot: classify precise GC and nil-check cases - #2313

Merged
cpunion merged 5 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-compile-diagnostics-notapplicable-20260813
Aug 13, 2026
Merged

test/goroot: classify precise GC and nil-check cases#2313
cpunion merged 5 commits into
xgo-dev:mainfrom
cpunion:codex/goroot-compile-diagnostics-notapplicable-20260813

Conversation

@cpunion

@cpunion cpunion commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • classify thirteen GOROOT cases that require precise GC liveness, typed stack maps, or exact finalizer timing as not applicable to LLGo's conservative BDWGC runtime
  • classify nilptr2.go and nilptr.go as not applicable because they require cmd/compile-style comprehensive explicit nil checks for derived or large-offset addresses that may not fault
  • replace 37 platform/version-specific xfail or flaky selectors with 15 mechanism-based entries in notapplicable.yaml

Scope

BDWGC conservatively scans native stack and register roots. LLGo therefore does not provide Go's precise PC-specific liveness maps, typed roots that exclude pointer-shaped integers, typed cross-frame stack-object tracing, or exact finalizer timing. The thirteen GC and finalizer cases exercise those implementation properties rather than portable language behavior LLGo currently plans to reproduce.

LLGo preserves the required nil panic for an unused dereference in #2256. The remaining nilptr2.go and nilptr.go cases require a broader cmd/compile-style nil-check insertion strategy for address-only, derived-address, and large-offset operations. LLGo currently relies on LLVM and target memory faults for those forms and does not plan to reproduce that compiler strategy.

Parser and diagnostic errorcheck cases are deliberately left in xfail.yaml; this PR does not classify them as not applicable.

The test directives are unchanged and all cases continue to run. This only separates behavior outside the current compatibility goal from the remaining actionable xfail count.

Validation

  • go test ./test/goroot -run '^(TestRepositoryExpectationsAreSeparated|TestNotApplicableMatch|TestXFailMatch)$' -count=1
  • git diff --check

Move four exact cmd/compile diagnostic mismatches out of the LLGo compatibility xfail count. Keep issue4405 and bombad in xfail because open PR xgo-dev#2265 addresses them.

There are currently no compile-directive xfails.

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

This PR reclassifies 4 errorcheck cases (fixedbugs/issue4776.go, issue13266.go, issue20789.go, bug050.go) from xfails in test/goroot/xfail.yaml to not_applicable in test/goroot/notapplicable.yaml, with reasons rewritten to the shared "not applicable" format.

Verified against the harness invariants:

  • All 4 selectors were fully removed from xfail.yaml and appear exactly once in notapplicable.yaml, so the "appears in both files" check (runner_unit_test.go:155-158) and the runtime double-match guard (runner_test.go:355) stay satisfied.
  • All 4 reasons satisfy TestRepositoryExpectationsAreSeparated (start with not applicable:, contain LLGo and compatibility goal).
  • Pure data change; no matching-logic or performance impact.

One inline finding on accuracy of the bug050.go reason (verified against upstream source). No security or performance issues found.

Comment thread test/goroot/notapplicable.yaml Outdated
@cpunion cpunion changed the title test/goroot: classify compiler diagnostics as not applicable test/goroot: classify toolchain diagnostics and precise GC liveness Aug 13, 2026
@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@cpunion cpunion changed the title test/goroot: classify toolchain diagnostics and precise GC liveness test/goroot: classify precise GC and nil-check cases Aug 13, 2026
@cpunion cpunion added the go-test-compat Go standard-library and GOROOT test compatibility label Aug 13, 2026
@github-actions

Copy link
Copy Markdown

LLGo baseline benchmarks

0efe2c7ae904 | workflow run | long-term charts

Program measurements

Platform Workload File size vs base Build vs base Run vs base
Linux cprintf 18656 B +0.0% 257.954 ms -1.6% (better) 1.069 ms -0.1% (better)
Linux fmtprintf 1885672 B +0.0% 2.429 s -0.9% (better) 2.757 ms -3.1% (better)
Linux println 68480 B +0.0% 256.931 ms -0.9% (better) 1.342 ms +4.3% (worse)
macOS cprintf 84672 B +0.0% 357.312 ms -11.0% (better) 3.005 ms -43.7% (better)
macOS fmtprintf 1890016 B +0.0% 2.438 s +5.4% (worse) 10.372 ms -1.9% (better)
macOS println 121216 B +0.0% 312.251 ms +1.1% (worse) 3.659 ms +5.1% (worse)
Core language and compiler benchmarks
Platform Benchmark ns/op vs base
Linux BenchmarkLookupPCRandom 11.320 ns/op +1.5% (worse)
Linux BenchmarkMergeCompilerFlags 137.500 ns/op -0.4% (better)
Linux BenchmarkMergeLinkerFlags 93.070 ns/op -0.3% (better)
Linux BenchmarkChannelBuffered 56.750 ns/op +0.1% (worse)
Linux BenchmarkChannelHandoff 25117 ns/op -7.3% (better)
Linux BenchmarkDefer 42.340 ns/op +1.5% (worse)
Linux BenchmarkDirectCall 1.008 ns/op -13.1% (better)
Linux BenchmarkGlobalRead 1.246 ns/op +8.5% (worse)
Linux BenchmarkGlobalWrite 8.438 ns/op +0.0% (worse)
Linux BenchmarkGoroutine 35598 ns/op -2.7% (better)
Linux BenchmarkInterfaceCall 6.251 ns/op +0.7% (worse)
Linux BenchmarkRuntimeGetG 1.630 ns/op +0.2% (worse)
macOS BenchmarkLookupPCRandom 10.620 ns/op -0.9% (better)
macOS BenchmarkMergeCompilerFlags 96.790 ns/op -15.6% (better)
macOS BenchmarkMergeLinkerFlags 72.730 ns/op +5.7% (worse)
macOS BenchmarkChannelBuffered 24.340 ns/op +5.3% (worse)
macOS BenchmarkChannelHandoff 8604 ns/op +38.9% (worse)
macOS BenchmarkDefer 29.420 ns/op +2.0% (worse)
macOS BenchmarkDirectCall 1.043 ns/op -2.9% (better)
macOS BenchmarkGlobalRead 1.090 ns/op -0.5% (better)
macOS BenchmarkGlobalWrite 1.062 ns/op -2.2% (better)
macOS BenchmarkGoroutine 26732 ns/op -37.3% (better)
macOS BenchmarkInterfaceCall 4.624 ns/op +3.0% (worse)
macOS BenchmarkRuntimeGetG 2.027 ns/op +6.4% (worse)

Compared with 3f2ec409a461 measured in the same runner job.

@cpunion
cpunion merged commit 9084d6e into xgo-dev:main Aug 13, 2026
44 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go-test-compat Go standard-library and GOROOT test compatibility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant