Skip to content

Swift Compiler crash with isolated deinit #82523

Closed
@fritzt0

Description

@fritzt0

Description

The Swift compiler in Xcode 16 beta 1 & 2 crashes when targeting iOS with the following code:

import UIKit

class MyView: UIView {
  isolated deinit {}
}

More examples without the involvement of UIKit are shown in the Swift forum thread

I’m very grateful for any solution.

Reproduction

import UIKit

class MyView: UIView {
  isolated deinit {}
}

Stack dump

1.	Apple Swift version 6.2 (swiftlang-6.2.0.10.950 clang-1700.3.10.950)
2.	Compiling with effective version 5.10
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module IsoDeinitCrash)
4.	While silgen emitDestructor -dealloc SIL function "@$s14IsoDeinitCrash6MyViewCfZ".
 for 'deinit' (at /Users/fritter/Temp/IsoDeinitCrash/IsoDeinitCrash/IsoDeinitCrash.swift:11:12)
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           0x000000010717b450 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000107178de0 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x000000010717ba7c SignalHandler(int, __siginfo*, void*) + 344
3  libsystem_platform.dylib 0x000000019f460624 _sigtramp + 56
4  swift-frontend           0x00000001019419c8 swift::Lowering::SILGenFunction::emitObjCDestructor(swift::SILDeclRef) + 468
5  swift-frontend           0x00000001019419c8 swift::Lowering::SILGenFunction::emitObjCDestructor(swift::SILDeclRef) + 468
6  swift-frontend           0x00000001018c2bdc swift::Lowering::SILGenModule::emitDeallocatorImpl(swift::SILDeclRef, swift::SILFunction*) + 1484
7  swift-frontend           0x00000001018c16c0 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 5656
8  swift-frontend           0x00000001018c45b0 swift::Lowering::SILGenModule::emitObjCAllocatorDestructor(swift::ClassDecl*, swift::DestructorDecl*) + 152
9  swift-frontend           0x00000001018c4b8c swift::Lowering::SILGenModule::emitDestructor(swift::ClassDecl*, swift::DestructorDecl*) + 564
10 swift-frontend           0x0000000101a22b14 (anonymous namespace)::SILGenType::emitType() + 568
11 swift-frontend           0x00000001018bfda8 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 100
12 swift-frontend           0x00000001018c6c1c swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 2364
13 swift-frontend           0x0000000101a09e80 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)17>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 208
14 swift-frontend           0x00000001018cb6a4 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 572
15 swift-frontend           0x0000000100de8580 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 2616
16 swift-frontend           0x0000000100deb274 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1764
17 swift-frontend           0x0000000100de9e90 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3580
18 swift-frontend           0x0000000100d6b444 swift::mainEntry(int, char const**) + 5412
19 dyld                     0x000000019f086b98 start + 6076

Expected behavior

no crash

Environment

swift-driver version: 1.127.5.3 Apple Swift version 6.2 (swiftlang-6.2.0.10.950 clang-1700.3.10.950)
Target: arm64-apple-macosx15.0

Xcode 16 beta 2 on macOS 15.5

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.concurrencyFeature: umbrella label for concurrency language featurescrashBug: A crash, i.e., an abnormal termination of software

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions