0 Replies
      Latest reply on Nov 8, 2019 2:30 PM by technomage
      technomage Level 1 Level 1 (0 points)

        When building I am seeing reliable segmentation fault 11 errors on one project.  If I refactor the code into smaller parts it some times gets that one part to compile but then another fails.  The current failure is in a 3 line function I can not really refactor further.  Any suggestions on workarounds welcome.

         

        struct Project : Codable, Identifiable, Equatable, ListEntry {
          var id : UUID = UUID()
          var name : String = UUID().uuidString
          
          func save(store: UndoableEventStore, n: Int) {
            let act = ListAction.create(at: n, obj:self)
            let e = ListChange<Project,Role>(subject: self.id,
              action: act)
            store.append(e)
          }
        }
        

         

        1. While emitting IR SIL function "@$s4Ladi7ProjectV4save5store1nyAA18UndoableEventStoreC_SitF".

        for 'save(store:n:)' (at /Users/lattam/Projects/Ladi/Ladi/Models/Project.swift:17:3)

        0  swift                    0x0000000104d87a13 PrintStackTraceSignalHandler(void*) + 51

        1  swift                    0x0000000104d871e6 SignalHandler(int) + 358

        2  libsystem_platform.dylib 0x00007fff6b6dab1d _sigtramp + 29

        3  libsystem_platform.dylib 0x00000001063dbe00 _sigtramp + 2597327616

        4  swift                    0x0000000100c5b615 emitDirectTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanType, swift::irgen::DynamicMetadataRequest) + 197

        5  swift                    0x0000000100c5ff05 swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType, swift::irgen::DynamicMetadataRequest) + 149

        6  swift                    0x0000000100c61670 swift::CanTypeVisitor<(anonymous namespace)::EmitTypeMetadataRefForLayout, llvm::Value*, swift::irgen::DynamicMetadataRequest>::visit(swift::CanType, swift::irgen::DynamicMetadataRequest) + 112

        7  swift                    0x0000000100c61bea swift::CanTypeVisitor<(anonymous namespace)::EmitTypeMetadataRefForLayout, llvm::Value*, swift::irgen::DynamicMetadataRequest>::visit(swift::CanType, swift::irgen::DynamicMetadataRequest) + 1514

        8  swift                    0x0000000100c61fbc swift::irgen::IRGenFunction::emitTypeMetadataRefForLayout(swift::SILType, swift::irgen::DynamicMetadataRequest) + 44

        9  swift                    0x0000000100b78253 swift::irgen::IRGenFunction::emitValueWitnessTableRef(swift::SILType, swift::irgen::DynamicMetadataRequest, llvm::Value**) + 211

        10 swift                    0x0000000100b87b68 swift::irgen::emitLoadOfSize(swift::irgen::IRGenFunction&, swift::SILType) + 168

        11 swift                    0x0000000100ada82d swift::irgen::WitnessSizedTypeInfo<(anonymous namespace)::NonFixedEnumTypeInfo>::allocateStack(swift::irgen::IRGenFunction&, swift::SILType, llvm::Twine const&) const + 45

        12 swift                    0x0000000100c16758 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 37608

        13 swift                    0x0000000100c0a8fa swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9834

        14 swift                    0x0000000100ab7080 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1712

        15 swift                    0x0000000100be7675 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1189

        16 swift                    0x00000001009d3e31 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 36673

        17 swift                    0x00000001009c76e4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820

        18 swift                    0x0000000100954be3 main + 1219

        19 libdyld.dylib            0x00007fff6b4d92e5 start + 1

        error: Segmentation fault: 11 (in target 'Ladi' from project 'Ladi')