Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-5925] non-Darwin aarch64 fails to map va_list to CVaListPointer #48484

Closed
swift-ci opened this issue Sep 18, 2017 · 3 comments
Closed

[SR-5925] non-Darwin aarch64 fails to map va_list to CVaListPointer #48484

swift-ci opened this issue Sep 18, 2017 · 3 comments
Labels
arm64 Architecture: arm64 (aarch64) — any 64-bit ARM bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-5925
Radar None
Original Reporter paulmenage (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, ClangImporter, aarch64
Assignee None
Priority Medium

md5: 239df08cd73e174909d19b490bf6b43d

duplicates:

  • SR-2239 CVaListPointer does not gets converted to va_list on aarch64

Issue Description:

When mapping C va_list-like types to CVaListPointer, ImportDecl.cpp checks

if (ClangTypeSize != ClangCtx.getTypeSize(ClangCtx.VoidPtrTy))

and ignores the mapping if the va_list type isn't the same size as a pointer. On non-Darwin aarch64, va_list is defined as a five-element structure rather than a pointer, so this check fails, and va_list C APIs don't get imported with Swift.CVaPointerList parameters.

However, since the aarch64 calling convention passes this struct by reference (as it's larger than two words) the ABI is basically the same - the value that gets passed as a va_list argument is a pointer-to-struct. So presumably this check should be relaxed on aarch64 at least.

@belkadan
Copy link
Contributor

I don't think that's sufficient. What we're really checking is that the CVaListPointer type defined in Swift is going to be layout-compatible with a va_list declared in C—not just as an argument, but also as, say, a member of a struct. Someone with actual AArch64 knowledge is going to have to look into this.

@swift-ci
Copy link
Collaborator Author

Comment by Paul Menage (JIRA)

Ah, I'd not thought about the case of embedding it in a structure.

Is it too late to rename CVaListPointer to just CVaList? Or is it better to put up with calling it CVaListPointer even though it's not a plain pointer on aarch64?

@belkadan
Copy link
Contributor

I don't think it's impossible to rename, although we might not be able to get rid of the old name. That would have to go through the Swift Evolution Process, though.

cc @gparker42

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arm64 Architecture: arm64 (aarch64) — any 64-bit ARM bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants