Skip to content

reflect: handle empty fields in FFI struct calls#1897

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

reflect: handle empty fields in FFI struct calls#1897
cpunion wants to merge 1 commit into
xgo-dev:mainfrom
cpunion:codex/goroot-reflectcall-coverage

Conversation

@cpunion
Copy link
Copy Markdown
Collaborator

@cpunion cpunion commented May 22, 2026

Summary

  • Skip zero-sized struct fields when building reflect libffi struct argument types, while preserving explicit gaps before later non-zero fields.
  • Add test/go coverage for reflect.Value.Call with a struct containing an empty trailing field followed by a slice argument.
  • Remove the darwin/arm64 GOROOT xfail for fixedbugs/issue26335.go after targeted local pass.

Focused tests

  • go test ./test/goroot -run TestGoRootRunCases -count=1 -args -goroot "$(go env GOROOT)" -llgo /tmp/llgo-reflectcall -dirs fixedbugs -case "^fixedbugs/issue26335\.go$" -xfail /tmp/llgo-empty-xfail.yaml -run-timeout 30s -build-timeout 2m
  • go test ./test/goroot -run TestGoRootRunCases -count=1 -args -goroot "$(go env GOROOT)" -llgo /tmp/llgo-reflectcall -dirs fixedbugs -case "^fixedbugs/issue26335\.go$" -run-timeout 30s -build-timeout 2m
  • /tmp/llgo-reflectcall test -run TestReflectCallStructWithEmptyField ./test/go
  • go test ./test/go -run TestReflectCallStructWithEmptyField -count=1
  • (cd runtime && go test ./internal/lib/reflect ./internal/ffi -count=1)

GOROOT CI

The full GOROOT workflow is workflow_dispatch-only and slow/disabled for normal PR CI. I kept the run targeted locally with the current machine GOROOT (go env GOROOT = /opt/homebrew/Cellar/go@1.24/1.24.11/libexec). If manual GOROOT dispatch cannot resolve fork refs, this PR should rely on normal PR CI from the cpunion/llgo fork branch and keep that blocker documented here rather than pushing any branch to xgo-dev/llgo.

Notes

I only removed the darwin/arm64 xfail entry verified locally. Linux version-specific xfails for the same upstream case remain until they can be executed on Linux.

@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