We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Toolchain: Xcode 13 default toolchain (Swift 5.5)
Build mode: Debug
Optimization level: No optimization (-Onone)
Compilation Mode: Incremental
OS: macOS Big Sur (version 11.6)
Device: iMac (24-inch, M1, 2021)
Memory: 8 GB
I can also provide more detail if needed.
md5: d164d68c896294749a17b52a8899d0ea
Issue Description:
Hello. After updating to Xcode 13 from 12.5.1, certain part of my code does not compile and throws "Segmentation fault: 11" error.
I don't know if my issue is a bug or not, I just heard that I should report compiler crashes. and my issue seems to be so.
I'll place the call stack bellow. and after that i'll explain my code.
4. While evaluating request IRGenRequest(IR Generation for file "/Users/mralirezaa/Developer/App/Karafs-New/NewPersistance/Definitions/DataProvider/DataProvider+SoftDeletable.swift") 5. While emitting IR SIL function "@$s6Karafs12DataProviderPA2A13SoftDeletable8AppModel_05StoreG0RPzrlE04makedE5Query33_7F8859D38810A08B5A70D31703D4C9BDLL4fromAA0J0Vy0H0QzGAO_tF". for 'makeSoftDeletableQuery(from:)' (at /Users/mralirezaa/Developer/App/Karafs-New/NewPersistance/Definitions/DataProvider/DataProvider+SoftDeletable.swift:12:13) 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 0x00000001065985e4 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56 1 swift-frontend 0x00000001065976ec llvm::sys::RunSignalHandlers() + 128 2 swift-frontend 0x0000000106598c24 SignalHandler(int) + 292 3 libsystem_platform.dylib 0x000000019453ec44 _sigtramp + 56 4 swift-frontend 0x000000010271b5f8 swift::irgen::MetadataPath::followComponent(swift::irgen::IRGenFunction&, swift::irgen::LocalTypeDataKey&, swift::irgen::MetadataResponse, swift::irgen::MetadataPath::Component, swift::irgen::DynamicMetadataRequest) + 1724 5 swift-frontend 0x000000010271b5f8 swift::irgen::MetadataPath::followComponent(swift::irgen::IRGenFunction&, swift::irgen::LocalTypeDataKey&, swift::irgen::MetadataResponse, swift::irgen::MetadataPath::Component, swift::irgen::DynamicMetadataRequest) + 1724 6 swift-frontend 0x000000010271ab24 swift::irgen::MetadataPath::follow(swift::irgen::IRGenFunction&, swift::irgen::LocalTypeDataKey, swift::irgen::MetadataResponse, swift::EncodedSequence<swift::irgen::MetadataPath::Component>::iterator, swift::EncodedSequence<swift::irgen::MetadataPath::Component>::iterator, swift::irgen::DynamicMetadataRequest, swift::EncodedSequence<swift::irgen::MetadataPath::Component>::Map<swift::irgen::MetadataResponse>*) + 580 7 swift-frontend 0x0000000102601cc0 swift::irgen::emitArchetypeWitnessTableRef(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::ArchetypeType>, swift::ProtocolDecl*) + 1960 8 swift-frontend 0x0000000102601464 swift::irgen::emitArchetypeTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanTypeWrapper<swift::ArchetypeType>, swift::irgen::DynamicMetadataRequest) + 652 9 swift-frontend 0x00000001027ca7c0 emitDirectTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanType, swift::irgen::DynamicMetadataRequest) + 196 10 swift-frontend 0x00000001027c9dbc swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType, swift::irgen::DynamicMetadataRequest) + 256 11 swift-frontend 0x00000001026f8ca4 swift::irgen::IRGenFunction::emitValueWitnessTableRef(swift::SILType, swift::irgen::DynamicMetadataRequest, llvm::Value**) + 440 12 swift-frontend 0x000000010270c874 swift::irgen::emitLoadOfSize(swift::irgen::IRGenFunction&, swift::SILType) + 132 13 swift-frontend 0x0000000102605764 swift::irgen::WitnessSizedTypeInfo<(anonymous namespace)::OpaqueArchetypeTypeInfo>::allocateStack(swift::irgen::IRGenFunction&, swift::SILType, llvm::Twine const&) const + 52 14 swift-frontend 0x000000010279a71c swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 39440 15 swift-frontend 0x000000010278c180 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 7732 16 swift-frontend 0x0000000102666684 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&) + 1332 17 swift-frontend 0x000000010275fd44 swift::IRGenRequest::evaluate(swift::Evaluator&, swift::IRGenDescriptor) const + 7572 18 swift-frontend 0x000000010278a074 swift::SimpleRequest<swift::IRGenRequest, swift::GeneratedModule (swift::IRGenDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::IRGenRequest const&, swift::Evaluator&) + 188 19 swift-frontend 0x000000010276a1c4 llvm::Expected<swift::IRGenRequest::OutputType> swift::Evaluator::getResultUncached<swift::IRGenRequest>(swift::IRGenRequest const&) + 752 20 swift-frontend 0x00000001027639e4 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**) + 236 21 swift-frontend 0x000000010232e300 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*) + 2544 22 swift-frontend 0x00000001023214fc swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6508 23 swift-frontend 0x000000010227be6c main + 932 24 libdyld.dylib 0x0000000194511430 start + 4 error: Segmentation fault: 11 (in target 'Karafs' from project 'Karafs')
Code Explanation:
protocol Store { associatedtype Object: RealmSwift.Object, Queryable var realm: Realm { get set } func fetch(query: Query<Self>, completion: ([Object]) -> Void) } struct Query<S: Store> { var store: S var predicate: Predicate<S.Object>? // This line is not important. func execute(completion: ([S.Object]) -> Void) { store.fetch(query: self, completion: completion) } } protocol DataProvider { associatedtype Store: Karafs.Store associatedtype AppModel: StorableModel where AppModel.StoreModel == Store.Object var store: Store { get set } init(store: Store) func fetch(query: Query<Store>, completion: ([AppModel]) -> Void) } protocol SoftDeletable { var isDeleted: Bool { get set } } extension DataProvider where Store.Object: SoftDeletable { private func makeSoftDeletableQuery(from query: Query<Self.Store>) -> Query<Self.Store> { // <-- this line is where segmentation fault happens. Query( store: store, predicate: query.predicate && .init(stringValue: "isDeleted") == false, sortCriteria: query.sortCriteria) } func fetch(query: Query<Store>, completion: ([AppModel]) -> Void) { let newQuery = makeSoftDeletableQuery(from: query) store.fetch(query: newQuery) { storeModels in let appModels = storeModels.map(AppModel.init(_:)) completion(appModels) } } }
and:
protocol ChangeWeightGoalStore: Store where Object == ChangeWeightGoalStoreModel {} struct ChangeWeightGoalDataProvider<S: ChangeWeightGoalStore>: DataProvider { typealias AppModel = GoalChange var store: S init(store: S) { self.store = store } init() where S == ChangeWeightGoalRealmStore { self.store = ChangeWeightGoalRealmStore() } } class ChangeWeightGoalStoreModel: Object, Queryable, SyncableModel, SoftDeletable, Identifiable { @Persisted(primaryKey: true) var id: String @Persisted var target: Double = 0 @Persisted var state: ChangeWeightGoalState = .default @Persisted var difficulty: ChangeWeightGoalDifficulty = .easy @Persisted var isDeleted: Bool = false @Persisted var syncStatus: SyncableModelStatus = .new enum QueryableKeys: String, QueryKey { case id case state case target case difficulty case isDeleted case syncStatus } } struct GoalChange: StorableModel { var id: String var state: GoalChangeState var target: Double var difficulty: Difficulty init( id: String, state: GoalChangeState, target: Double, difficulty: Difficulty ) { self.id = id self.state = state self.target = target self.difficulty = difficulty } init(_ storeModel: ChangeWeightGoalStoreModel) { self.id = storeModel.id self.target = storeModel.target self.state = GoalChangeState(storeModel.state) self.difficulty = Difficulty(storeModel.difficulty) } static func convertToStoreModel(_ model: GoalChange) -> ChangeWeightGoalStoreModel { let storeModel = ChangeWeightGoalStoreModel() storeModel.id = model.id storeModel.target = model.target storeModel.state = ChangeWeightGoalState(model.state) storeModel.difficulty = ChangeWeightGoalDifficulty(model.difficulty) storeModel.isDeleted = false storeModel.syncStatus = .new return storeModel } }
I marked where the segmentation fault: 11 happens using "// <– this line is where segmentation fault happens." this comment in the first code section.
I can provide additional implementation detail if required.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Environment
Toolchain: Xcode 13 default toolchain (Swift 5.5)
Build mode: Debug
Optimization level: No optimization (-Onone)
Compilation Mode: Incremental
OS: macOS Big Sur (version 11.6)
Device: iMac (24-inch, M1, 2021)
Memory: 8 GB
I can also provide more detail if needed.
Additional Detail from JIRA
md5: d164d68c896294749a17b52a8899d0ea
Issue Description:
Hello. After updating to Xcode 13 from 12.5.1, certain part of my code does not compile and throws "Segmentation fault: 11" error.
I don't know if my issue is a bug or not, I just heard that I should report compiler crashes. and my issue seems to be so.
I'll place the call stack bellow. and after that i'll explain my code.
Code Explanation:
and:
I marked where the segmentation fault: 11 happens using "// <– this line is where segmentation fault happens." this comment in the first code section.
I can provide additional implementation detail if required.
The text was updated successfully, but these errors were encountered: