Building with Xcode 12.5 fails with CompileSwift failed with a nonzero exit code and Segmentation fault: 11

Project building started failing when I updated Xcode to 12.5. I'm getting two errors: CompileSwift failed with a nonzero exit code and Segmentation fault: 11

Each of these errors is printing out bunch of swift files which are normally used in project.
Output format is like this:
Code Block
Compile abcd.swift (arm64)
Segmentation fault: 11


and

Code Block
Compile abcd.swift (arm64)
Command CompileSwift failed with a nonzero exit code

I've tried with clean build, removing derived data, updating pods, and even restarting laptop and nothing works.



Segmentation fault is an indication of a compiler bug and you should better send a bug report soon.

Can you create a simplified project to reproduce the issue, using the actual abcd.swift?
Simplified project wouldn't be that easy to do since I have more than 30 swift files reported.
If that may help…

I once had a segmentation fault 11.

Reason was:
In a struct defined as:
Code Block
struct L {
var u1: UInt64
var u2: UInt64
var u3: UInt64
var u4: UInt64
}

I defined a subscript
Code Block
extension L {
    subscript (j: Int, h: Int) -> Bool? {
}

As far as I remember, the fault occurred if I called
Code Block
var lib  : [L]?
if lib[j,h] { }

instead of unwrapping:
Code Block
if lib![j,h] { }

Hope that may help.

I'm having this exact same problem. My macOS app builds and runs fine with Xcode 12.4 but produces Segmentation fault: 11 when I try 12.5.

Building with Xcode 12.5 fails with CompileSwift failed with a nonzero exit code and Segmentation fault: 11
 
 
Q