Swift 1.2 segmentation error when compiling a release scheme

I just upgraded to Swift 1.2, and when I try to compile an iOS application using the Release schema, I get "segmentation fault: 11".

0  swift                    0x00000001105a9a08 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x00000001105a9ee4 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff9a724f1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff4fd6f6b0 _sigtramp + 3043272624
4  swift                    0x00000001100e837a (anonymous namespace)::DCE::markControllingTerminatorsLive(swift::SILBasicBlock*) + 346
5  swift                    0x00000001100e8109 (anonymous namespace)::DCE::markValueLive(swift::ValueBase*) + 201
6  swift                    0x00000001100e791f (anonymous namespace)::DCE::run() + 1983
7  swift                    0x000000011008f55e swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) + 1310
8  swift                    0x000000011008ffe9 swift::SILPassManager::runOneIteration() + 633
9  swift                    0x000000011008ea56 swift::runSILOptimizationPasses(swift::SILModule&) + 790
10 swift                    0x000000010fe92ee7 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 4695
11 swift                    0x000000010fe91ae6 main + 1814
12 libdyld.dylib            0x00007fff995665c9 start + 1

The application compiles and works fine when I use the Dev / Debug scheme.

I narrowed down the compiler problem to one file and a couple of lines of code.

let directPhoneType = PhoneNumber.Codes.Contacts["D"]
phoneTypes = phoneTypes.filter { $0 != directPhoneType }

I tried to change the filtering code (using "element in", etc.), but each attempt causes segmentation to break. There is another filtering logic in our application that compiles fine.

If I delete the filter code or change it to a cycle that manually filters phone types, the application works fine in the release scheme.

" , " " ", . ""; .

Swift 1.2 .

- , ?

: , Xcode 6.3.1 seg.

+4
3

, , . ( ) , .

+4

, . , . .

, , : unowned, , weak, , ??, " " (, max(min(x,y),z)), let var ..

let var

var resultList = [MyType]()
for type in phoneTypes {
     if type != directPhoneType {
         resultList.append(type)
     }
}

PhoneNumber.Codes.Contacts["D"], -.

! .

+1

I had this problem when switching to Swift 1.2, not just the release chart. During the migration, I changed the recommended "how!" how? "thinking that this is what I wanted. It apparently caused the problem; I came back and changed to" how! "and it worked.

0
source

All Articles