"segmentation fault: 11" when compiling Swift 1.2

HI all,

I'm getting a very frustrating error while compiling Swift 1.2 code with XCode 6.4.

This is the piece of code causing the problem:


let datasource: SPBaseDataSource? = collectionView.dataSource as? SPBaseDataSource


where SPBaseDataSource is a protocol defined as follows:


protocol SPBaseDataSource: UICollectionViewDataSource {
// some methods
}


without that piece of code the projects builds fine, adding that line makes the compiler crash with the following stack:


0  swift                    0x0000000100e772b8 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x0000000100e77794 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff9231cf1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff5f49d1f0 _sigtramp + 3440902896
4  swift                    0x00000001007fc570 (anonymous namespace)::ProtocolPath::findBetterPath(swift::ProtocolDecl*, swift::irgen::ProtocolInfo const&, unsigned int) + 272
5  swift                    0x00000001007fb39a getProtocolWitnessTable(swift::irgen::IRGenFunction&, swift::CanType, swift::irgen::TypeInfo const&, (anonymous namespace)::ProtocolEntry, swift::ProtocolConformance*) + 218
6  swift                    0x00000001007fadab forEachProtocolWitnessTable(swift::irgen::IRGenFunction&, swift::CanType, swift::CanType, llvm::ArrayRef<(anonymous namespace)::ProtocolEntry>, llvm::ArrayRef<swift::ProtocolConformance*>, std::__1::function<void (unsigned int, llvm::Value*)>) + 363
7  swift                    0x00000001007fafd1 swift::irgen::emitOpaqueExistentialContainerInit(swift::irgen::IRGenFunction&, swift::irgen::Address, swift::SILType, swift::CanType, swift::SILType, llvm::ArrayRef<swift::ProtocolConformance*>) + 433
8  swift                    0x0000000100841471 swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 25793
9  swift                    0x000000010083a39d swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9901
10 swift                    0x00000001007a5147 swift::irgen::IRGenModule::emitLazyDefinitions() + 151
11 swift                    0x0000000100824cec performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 2268
12 swift                    0x0000000100825693 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 51
13 swift                    0x0000000100761087 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 6647
14 swift                    0x000000010075f4e6 main + 1814
15 libdyld.dylib            0x00007fff8d83d5c9 start + 1


Any ideas of how to work around the problem?

thanks

M.

It works on my version so there's probably something in your SPBaseDataSource that's causing it. Please post the contents SPBaseDataSource and the stack dump which contains something like "

While emitting IR SIL function..."
"segmentation fault: 11" when compiling Swift 1.2
 
 
Q