Uploaded image for project: 'Swift'
  1. Swift
  2. SR-2239

`CVaListPointer` does not gets converted to `va_list` on `aarch64`

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Medium
    • Resolution: Unresolved
    • Component/s: Compiler
    • Environment:

      OS: Ubuntu 16.04 xenial
      Kernel: 3.10.65-7-pine64-longsleep #28 SMP PREEMPT Sat Apr 23 20:13:25 CEST 2016 aarch64 aarch64 aarch64 GNU/Linux
      CPU: Cortex A53 / ARMv8-A (active state AArch64) @ 1.2Ghz x 4 cores
      Board: Pine64

      Description

      I'm getting an error when trying to compile corelibs-foundation in arm. When the compile process is done with CoreFoundation and gets to the Swift wrappers, it's failing trying to compile NSString.init(format: String: arguments: CVaListPointer) and sibling methods.

      cannot convert value of type 'CVaListPointer' to expected argument type 'va_list' (aka '__va_list')

      SR-1412 reported problems when trying to resolve the correct va_list in arm. Based on the error message we're getting, and what was the issue at that time, my theory is swift project is resolving va_list and __va_list in a different way as corelibs-foundation does for arm's toolchain. Then the mapped types defined here are failing to work:

      // stdarg.h types.
      // FIXME: why does this not catch va_list on x86_64?
      MAP_STDLIB_TYPE("va_list", VaList, 0, "CVaListPointer", false, DoNothing)
      MAP_STDLIB_TYPE("__gnuc_va_list", VaList, 0, "CVaListPointer", false, DoNothing)
      MAP_STDLIB_TYPE("__va_list", VaList, 0, "CVaListPointer", false, DoNothing)
      

      https://github.com/apple/swift/blob/621d3b7c666b92b8078624a8d228e1c123f23bca/lib/ClangImporter/MappedTypes.def#L126-L130

      Again, is just a theory, I couldn't prove it yet.

      Complete compilation call as executed by the build script with the following parameters:

      utils/build-script -R --libdispatch 1 --xctest 1 --foundation 1

      ubuntu@localhost:~/swift-source/swift-corelibs-foundation$ /home/ubuntu/swift-source/build/Ninja-ReleaseAssert/swift-linux-aarch64/bin/swift -frontend -c Foundation/NSObject.swift Foundation/NSAffineTransform.swift Foundation/NSArray.swift Foundation/NSAttributedString.swift Foundation/NSBundle.swift Foundation/NSByteCountFormatter.swift Foundation/NSCache.swift Foundation/NSCalendar.swift Foundation/NSCFArray.swift Foundation/NSCFDictionary.swift Foundation/NSCFSet.swift Foundation/NSCFString.swift Foundation/NSCharacterSet.swift Foundation/NSCFCharacterSet.swift Foundation/NSCoder.swift Foundation/NSComparisonPredicate.swift Foundation/NSCompoundPredicate.swift Foundation/NSConcreteValue.swift Foundation/NSData.swift Foundation/NSDate.swift Foundation/NSDateComponentsFormatter.swift Foundation/NSDateFormatter.swift Foundation/NSDateIntervalFormatter.swift Foundation/NSDecimal.swift Foundation/NSDecimalNumber.swift Foundation/NSDictionary.swift Foundation/NSEnergyFormatter.swift Foundation/NSEnumerator.swift Foundation/NSError.swift Foundation/NSExpression.swift Foundation/NSFileHandle.swift Foundation/NSFileManager.swift Foundation/NSFormatter.swift Foundation/NSGeometry.swift Foundation/NSHost.swift Foundation/NSHTTPCookie.swift Foundation/NSHTTPCookieStorage.swift Foundation/NSIndexPath.swift Foundation/NSIndexSet.swift Foundation/NSJSONSerialization.swift Foundation/NSKeyedCoderOldStyleArray.swift Foundation/NSKeyedArchiver.swift Foundation/NSKeyedUnarchiver.swift Foundation/NSLengthFormatter.swift Foundation/NSLocale.swift Foundation/NSLock.swift Foundation/NSLog.swift Foundation/NSMassFormatter.swift Foundation/NSNotification.swift Foundation/NSNotificationQueue.swift Foundation/NSNull.swift Foundation/NSNumber.swift Foundation/NSNumberFormatter.swift Foundation/NSObjCRuntime.swift Foundation/NSOperation.swift Foundation/NSOrderedSet.swift Foundation/NSPathUtilities.swift Foundation/NSPersonNameComponents.swift Foundation/NSPersonNameComponentsFormatter.swift Foundation/NSPort.swift Foundation/NSPortMessage.swift Foundation/NSPredicate.swift Foundation/NSProcessInfo.swift Foundation/NSProgress.swift Foundation/NSPropertyList.swift Foundation/NSRange.swift Foundation/NSRegularExpression.swift Foundation/NSRunLoop.swift Foundation/NSScanner.swift Foundation/NSSet.swift Foundation/NSSortDescriptor.swift Foundation/NSSpecialValue.swift Foundation/NSStream.swift -primary-file Foundation/NSString.swift Foundation/String.swift Foundation/NSSwiftRuntime.swift Foundation/NSTask.swift Foundation/NSTextCheckingResult.swift Foundation/NSThread.swift Foundation/NSTimer.swift Foundation/NSTimeZone.swift Foundation/NSURL.swift Foundation/NSURLAuthenticationChallenge.swift Foundation/NSURLCache.swift Foundation/NSURLCredential.swift Foundation/NSURLCredentialStorage.swift Foundation/NSURLError.swift Foundation/NSURLProtectionSpace.swift Foundation/NSURLProtocol.swift Foundation/NSURLRequest.swift Foundation/NSURLResponse.swift Foundation/NSURLSession.swift Foundation/NSUserDefaults.swift Foundation/NSUUID.swift Foundation/NSValue.swift Foundation/NSXMLDocument.swift Foundation/NSXMLDTD.swift Foundation/NSXMLDTDNode.swift Foundation/NSXMLElement.swift Foundation/NSXMLNode.swift Foundation/NSXMLNodeOptions.swift Foundation/NSXMLParser.swift Foundation/FoundationErrors.swift Foundation/URL.swift Foundation/Boxing.swift Foundation/ReferenceConvertible.swift Foundation/Date.swift Foundation/Data.swift Foundation/CharacterSet.swift Foundation/URLRequest.swift Foundation/PersonNameComponents.swift Foundation/Notification.swift Foundation/URLComponents.swift Foundation/DateComponents.swift Foundation/DateInterval.swift Foundation/IndexPath.swift Foundation/IndexSet.swift Foundation/NSStringEncodings.swift Foundation/ExtraStringAPIs.swift Foundation/Measurement.swift Foundation/NSMeasurement.swift Foundation/NSMeasurementFormatter.swift Foundation/Unit.swift -I/home/ubuntu/swift-source/build/Ninja-ReleaseAssert/swift-linux-aarch64/lib/swift/linux -Xcc -fblocks -resource-dir /home/ubuntu/swift-source/build/Ninja-ReleaseAssert/swift-linux-aarch64/lib/swift -target aarch64-unknown-linux   -Ibootstrap/common/usr/include -Ibootstrap/common/usr/local/include   -Ibootstrap/aarch64-linux-gnu/usr/include -Ibootstrap/aarch64-linux-gnu/usr/local/include -O  -I../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation -I../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/usr//lib/swift -I../build/Ninja-ReleaseAssert/foundation-linux-aarch64 -I../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/usr/lib/swift -I/usr/include/libxml2 -I/home/ubuntu/swift-source/build/Ninja-ReleaseAssert/xctest-linux-aarch64 -L/home/ubuntu/swift-source/build/Ninja-ReleaseAssert/xctest-linux-aarch64 -I/usr/include/libxml2 -DDEPLOYMENT_ENABLE_LIBDISPATCH -I/home/ubuntu/swift-source/swift-corelibs-libdispatch -I/home/ubuntu/swift-source/build/Ninja-ReleaseAssert/libdispatch-linux-aarch64/src/swift -Xcc -fblocks -module-name Foundation -module-link-name Foundation -o ../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/Foundation/NSString.swift.o -emit-module-path ../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/Foundation/NSString.swift.o.~partial.swiftmodule -emit-module-doc-path ../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/Foundation/NSString.swift.o.~partial.swiftdoc -emit-dependencies-path ../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/Foundation/NSString.swift.o.d -emit-reference-dependencies-path ../build/Ninja-ReleaseAssert/foundation-linux-aarch64/Foundation/Foundation/NSString.swift.o.swiftdeps -module-cache-path ../build/Ninja-ReleaseAssert/foundation-linux-aarch64
      Foundation/NSString.swift:1198:106: error: cannot convert value of type 'CVaListPointer' to expected argument type 'va_list' (aka '__va_list')
              let str = CFStringCreateWithFormatAndArguments(kCFAllocatorSystemDefault, nil, format._cfObject, argList)!
                                                                                                               ^~~~~~~
      Foundation/NSString.swift:1206:148: error: cannot convert value of type 'CVaListPointer' to expected argument type 'va_list' (aka '__va_list')
                      str = CFStringCreateWithFormatAndArguments(kCFAllocatorSystemDefault, unsafeBitCast(loc, to: CFDictionary.self), format._cfObject, argList)
                                                                                                                                                         ^~~~~~~
      Foundation/NSString.swift:1211:106: error: cannot convert value of type 'CVaListPointer' to expected argument type 'va_list' (aka '__va_list')
                  str = CFStringCreateWithFormatAndArguments(kCFAllocatorSystemDefault, nil, format._cfObject, argList)
                                                                                                               ^~~~~~~
      Foundation/NSString.swift:1218:100: error: cannot convert value of type 'CVaListPointer' to expected argument type 'va_list' (aka '__va_list')
                  CFStringCreateWithFormatAndArguments(kCFAllocatorSystemDefault, nil, format._cfObject, vaPtr)
                                                                                                         ^~~~~
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              compnerd Saleem Abdulrasool
              Reporter:
              gonzalolarralde Gonzalo Larralde
              Votes:
              2 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated: