You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swift-ci opened this issue
Sep 18, 2017
· 3 comments
Labels
arm64Architecture: arm64 (aarch64) — any 64-bit ARMbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itself
SR-2239CVaListPointer 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.
The text was updated successfully, but these errors were encountered:
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.
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?
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.
arm64Architecture: arm64 (aarch64) — any 64-bit ARMbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itself
Additional Detail from JIRA
md5: 239df08cd73e174909d19b490bf6b43d
duplicates:
CVaListPointer
does not gets converted tova_list
onaarch64
Issue Description:
When mapping C va_list-like types to CVaListPointer, ImportDecl.cpp checks
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.
The text was updated successfully, but these errors were encountered: