Debug merge .swiftmodule: segmentation fault: 11

ios, segmentation-fault, swift, xcode

Solution

Adding `private` to static var fixed the issue:

private static var taskId = 0

...

Problem

I'm trying to compile Swift 1.2 iOS project with XCode v. 6.3 (6D520o). It goes through "Compile Swift source files" with ``` <unknown>:0: error: unable to execute command: Segmentation fault: 11 <unknown>:0: error: merge-module command failed due to signal (use -v to see invocation) ``` and crashes on "Merge Project.swiftmodule". Clang's stack trace: ``` 0 swift 0x000000010ffa8d38 llvm::sys::PrintStackTrace(__sFILE*) + 40 1 swift 0x000000010ffa9214 SignalHandler(int) + 452 2 libsystem_platform.dylib 0x00007fff84503f1a _sigtramp + 26 3 libsystem_c.dylib 0x00007fff91d6076c sprintf_l + 134 4 swift 0x000000011065a502 swift::getFullComment(swift::CommentContext&, swift::Decl const*) + 34 5 swift 0x000000010fba0e5a (anonymous namespace)::ObjCPrinter::printAbstractFunction(swift::AbstractFunctionDecl*, bool, bool) + 58 6 swift 0x000000010fba03ce (anonymous namespace)::ObjCPrinter::visitVarDecl(swift::VarDecl*) + 126 7 swift 0x000000010fba55c1 (anonymous namespace)::ObjCPrinter::printMembers(swift::IteratorRange<swift::DeclIterator>) + 433 8 swift 0x000000010fba0202 swift::ASTVisitor<(anonymous namespace)::ObjCPrinter, void, void, void, void, void, void>::visit(swift::Decl*) + 3266 9 swift 0x000000010fb9e45c swift::printAsObjC(llvm::raw_ostream&, swift::Module*, llvm::StringRef, swift::Accessibility) + 2876 10 swift 0x000000010f8a1bcc printAsObjC(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, swift::Module*, llvm::StringRef, bool) + 332 11 swift 0x000000010f8a04b5 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4901 12 swift 0x000000010f89efe6 main + 1814 13 libdyld.dylib 0x00007fff8f6ca5c9 start + 1 ``` And here is the full output of Compile and Merge phases. Is it possible to find the true cause of crash from the clang output? Or I have to delete code until it is works again?

Original source