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

Compiler crash when setting strict concurrency complete and default UIView param #73818

Closed
bartcone opened this issue May 22, 2024 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels

Comments

@bartcone
Copy link

bartcone commented May 22, 2024

Description

While prepping for Swift 6, I set Strict Concurrency Checking to Complete and encountered a compiler crash because of a default UIView param.

Reproduction

  • Xcode 15.4
  • Create a new app project
  • Set strict concurrency checking to complete
  • Create new file and paste the code below and try compiling
class CustomView: UIView {

    // default param of UIView() causes compiler crash
    // changing to nil compiles
    // lowering strict concurrency checking compiles
    init(foo: UIView? = UIView()) {
        super.init(frame: .zero)
    }

    required init?(coder: NSCoder) {
        nil
    }
}

class TestViewController: UIViewController {

    private let customView = CustomView()

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.addSubview(self.customView)
    }
}

Stack dump

Stack dump:
0.	Program arguments: /Applications/Xcode-15.4.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Users/bartcone/Documents/dev/StrictConcurrencyBug/StrictConcurrencyBug/TestViewController.swift /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/DerivedSources/GeneratedAssetSymbols.swift -emit-dependencies-path /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/TestViewController.d -emit-const-values-path /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/TestViewController.swiftconstvalues -emit-reference-dependencies-path /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/TestViewController.swiftdeps -serialize-diagnostics-path /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/TestViewController.dia -emit-localized-strings -emit-localized-strings-path /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64 -target arm64-apple-ios17.4-simulator -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk -I /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Products/Debug-iphonesimulator -F /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Products/Debug-iphonesimulator -no-color-diagnostics -enable-testing -g -module-cache-path /Users/bartcone/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -const-gather-protocols-file /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/StrictConcurrencyBug_const_extract_protocols.json -enable-bare-slash-regex -strict-concurrency=complete -empty-abi-descriptor -validate-clang-modules-once -clang-build-session-file /Users/bartcone/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -Xcc -working-directory -Xcc /Users/bartcone/Documents/dev/StrictConcurrencyBug -resource-dir /Applications/Xcode-15.4.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -ivfsstatcache -Xcc /Users/bartcone/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphonesimulator17.5-21F77-89c9b7af80e5612d0557fcca3b72165f.sdkstatcache -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/StrictConcurrencyBug-generated-files.hmap -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/StrictConcurrencyBug-own-target-headers.hmap -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/StrictConcurrencyBug-all-target-headers.hmap -Xcc -iquote -Xcc /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/StrictConcurrencyBug-project-headers.hmap -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Products/Debug-iphonesimulator/include -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/DerivedSources-normal/arm64 -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/DerivedSources/arm64 -Xcc -I/Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/DerivedSources -Xcc -DDEBUG=1 -module-name StrictConcurrencyBug -frontend-parseable-output -disable-clang-spi -target-sdk-version 17.5 -target-sdk-name iphonesimulator17.5 -external-plugin-path /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/lib/swift/host/plugins#/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator17.5.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode-15.4.0.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Applications/Xcode-15.4.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Applications/Xcode-15.4.0.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -o /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Build/Intermediates.noindex/StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/TestViewController.o -index-unit-output-path /StrictConcurrencyBug.build/Debug-iphonesimulator/StrictConcurrencyBug.build/Objects-normal/arm64/TestViewController.o -index-store-path /Users/bartcone/Library/Developer/Xcode/DerivedData/StrictConcurrencyBug-dibbntunibjwjtfewlxsuacsrdmj/Index.noindex/DataStore -index-system-modules
1.	Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
2.	Compiling with the current language version
3.	While evaluating request IRGenRequest(IR Generation for file "/Users/bartcone/Documents/dev/StrictConcurrencyBug/StrictConcurrencyBug/TestViewController.swift")
4.	While emitting IR SIL function "@$s20StrictConcurrencyBug18TestViewControllerC06customE033_03C22878A9D7B47F4D9332263C356D40LLAA06CustomE0Cvpfi".
 for expression at [/Users/bartcone/Documents/dev/StrictConcurrencyBug/StrictConcurrencyBug/TestViewController.swift:36:30 - line:36:41] RangeText="CustomView("
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000109febf3c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000109feb0f8 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000109fec544 SignalHandler(int) + 360
3  libsystem_platform.dylib 0x000000019137b584 _sigtramp + 56
4  swift-frontend           0x000000010497c79c llvm::IRBuilderBase::CreateAlignedLoad(llvm::Type*, llvm::Value*, llvm::MaybeAlign, bool, llvm::Twine const&) + 88
5  swift-frontend           0x000000010497c79c llvm::IRBuilderBase::CreateAlignedLoad(llvm::Type*, llvm::Value*, llvm::MaybeAlign, bool, llvm::Twine const&) + 88
6  swift-frontend           0x0000000104cd5704 swift::irgen::IRGenFunction::emitSuspensionPoint(swift::irgen::Explosion&, llvm::Value*) + 984
7  swift-frontend           0x0000000104e1e9a8 (anonymous namespace)::IRGenSILFunction::visitSILBasicBlock(swift::SILBasicBlock*) + 68520
8  swift-frontend           0x0000000104e0c4fc swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 11556
9  swift-frontend           0x0000000104c60430 swift::irgen::IRGenerator::emitGlobalTopLevel(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>> const&) + 2472
10 swift-frontend           0x0000000104dbf940 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 4016
11 swift-frontend           0x0000000104e0954c swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 176
12 swift-frontend           0x0000000104dcc264 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 836
13 swift-frontend           0x0000000104dc2438 swift::performIRGeneration(swift::FileUnit*, swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::GlobalVariable**) + 264
14 swift-frontend           0x00000001048f00b8 generateIR(swift::IRGenOptions const&, swift::TBDGenOptions const&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, swift::PrimarySpecificPaths const&, llvm::StringRef, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, llvm::GlobalVariable*&, llvm::ArrayRef<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>>) + 156
15 swift-frontend           0x00000001048ea294 performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1892
16 swift-frontend           0x00000001048e9444 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 608
17 swift-frontend           0x00000001048ed694 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1448
18 swift-frontend           0x00000001048eb6d0 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4968
19 swift-frontend           0x000000010487ae8c swift::mainEntry(int, char const**) + 2612
20 dyld                     0x0000000190fc20e0 start + 2360

Expected behavior

Expected an error or warning with descriptive reasoning.

Environment

swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)

Additional information

No response

@bartcone bartcone added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels labels May 22, 2024
@hborla
Copy link
Member

hborla commented Jul 14, 2024

I can't reproduce this in Swift 6.0. I believe this was fixed by #72332

@hborla hborla closed this as completed Jul 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. crash Bug: A crash, i.e., an abnormal termination of software triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

2 participants