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-11710] Misleading target triple in diagnostic "unknown-apple-ios13.3.0" #54118

Open
typesanitizer opened this issue Nov 5, 2019 · 2 comments
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement

Comments

@typesanitizer
Copy link

Previous ID SR-11710
Radar rdar://problem/56923080
Original Reporter @typesanitizer
Type Improvement
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Improvement, DiagnosticsQoI
Assignee None
Priority Medium

md5: 99515dd582e7d891606ee24c985df29b

Issue Description:

Say you are compiling for a target 'myarch-apple-ios13.0'. In case the compiler doesn't recognize the target, it should print the actual target triple that was passed as the argument, saying (ideally) "error: unknown target triple 'myarch-apple-ios13.0'" instead of saying (current) "error: unknown target triple 'unknown-apple-ios13.0'". The current diagnostic is unnecessarily misleading/confusing.

@typesanitizer
Copy link
Author

@swift-ci create

@beccadax
Copy link
Contributor

beccadax commented Nov 5, 2019

This doesn't reproduce for just any myarch; the architecture needs to start with arm64 and then have one more character, like arm64~-apple-ios13.

That triple passes the rudimentary triple checking in the Swift driver, IIRC because it fits a general pattern recognized by llvm::Triple. However, clang inspects the triple more deeply, discovers it's invalid, and emits a not-very-helpful diagnostic, which we pass through unmodified even though it's not correct for Swift (e.g. the command-line flags it mentions aren't correct for Swift). Example:

brent@broyalgordon ~> /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-11-01-a.xctoolchain/usr/bin/swift -v -Xfrontend -dump-clang-diagnostics -target arm64~-apple-ios13.0 /dev/null
Apple Swift version 5.1.1-dev (Swift 74328cdda2)
Target: arm64~-apple-ios13.0
/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-11-01-a.xctoolchain/usr/bin/swift -frontend -interpret /dev/null -target arm64~-apple-ios13.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -color-diagnostics -dump-clang-diagnostics -module-name null
'clang' '-fsyntax-only' '-fblocks' '-D__swift__=50101' '-fretain-comments-from-system-headers' '-isystem' '/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-11-01-a.xctoolchain/usr/lib/swift' '-fPIC' '-fmodules' '-Xclang' '-fmodule-feature' '-Xclang' 'swift' '-Werror=non-modular-include-in-framework-module' '-x' 'objective-c' '-std=gnu11' '-fobjc-arc' '-D_ISO646_H_' '-D__ISO646_H' '-DSWIFT_SDK_OVERLAY_APPKIT_EPOCH=2' '-DSWIFT_SDK_OVERLAY_FOUNDATION_EPOCH=8' '-DSWIFT_SDK_OVERLAY2_SCENEKIT_EPOCH=3' '-DSWIFT_SDK_OVERLAY_GAMEPLAYKIT_EPOCH=1' '-DSWIFT_SDK_OVERLAY_SPRITEKIT_EPOCH=1' '-DSWIFT_SDK_OVERLAY_COREIMAGE_EPOCH=2' '-DSWIFT_SDK_OVERLAY_DISPATCH_EPOCH=2' '-DSWIFT_SDK_OVERLAY_PTHREAD_EPOCH=1' '-DSWIFT_SDK_OVERLAY_COREGRAPHICS_EPOCH=0' '-DSWIFT_SDK_OVERLAY_UIKIT_EPOCH=2' '-DSWIFT_CLASS_EXTRA=' '-Xclang' '-nostdsysteminc' '-fmodules-validate-system-headers' '-Xclang' '-fmodule-format=obj' '-fapinotes-modules' '-fapinotes-swift-version=5' '-iapinotes-modules' '/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-11-01-a.xctoolchain/usr/lib/swift/apinotes' '-target' 'arm64~-apple-ios13.0' '<swift-imported-modules>' '-mcpu=cyclone' '-resource-dir' '/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2019-11-01-a.xctoolchain/usr/lib/swift/clang' '-fansi-escape-codes' '-working-directory' '/Users/brent'
warning: argument unused during compilation: '-mcpu=cyclone'
<unknown>:0: warning: argument unused during compilation: '-mcpu=cyclone'
error: unknown target triple 'unknown-apple-ios13.0', please use -triple or -arch
<unknown>:0: error: unknown target triple 'unknown-apple-ios13.0', please use -triple or -arch
<unknown>:0: error: clang importer creation failed

This is probably both a Swift bug (we should catch the invalid triple sooner and diagnose it ourselves) and a clang bug (it should give an error with a more useful message).

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler The Swift compiler in itself diagnostics QoI Bug: Diagnostics Quality of Implementation improvement
Projects
None yet
Development

No branches or pull requests

2 participants