Xcode 16.3 Compile fails

After updating to 16.3, my project now fails to compile with the diagnostic: "Command SwiftCompile failed with a nonzero exit code".

This is a SwiftUI document project with two local packages, the second of which is a rather large one with 112 SwiftUI files. It is this second package that is failing. There are no issues when compiling with 16.2. Without diagnostics I'm having a bit of difficulty in determining the cause. My thought is to regress the commits unit 16.3 gives a success, or shows issues.

Although I'm not catching a similar issue in the forums, I'm seeing other problems with 16.3. Has anyone else had such build failure isolated to 16.3? Any advice on other ways to approach this problem?

Thanks in advance

If the compiler fails with "Command SwiftCompile failed with a nonzero exit code" and no other diagnostics, does this mean that an assert was triggered in the compiler?

Under the conditions where the compiler fails with the sole diagnostic "Command SwiftCompile failed with a nonzero exit code", if I see an object file, in my case in:

.../Build/Intermediates.noindex/PurGMCViewLibrary.build/Debug-iphonesimulator/PurGMCViewLibrary.build/Objects-normal/arm64

does that mean the compiler did not fail to build that associated file?

For example I see the object file: PurGMCViewModifierAndShapeUtils.o

even though the report section fails with:

SwiftCompile normal arm64 .../PurGMCViewLibrary/PurGMCViewModifierAndShapeUtils.swift (in target 'PurGMCViewLibrary' from project 'PurGMCViewLibrary') cd ...

in:

Command SwiftCompile failed with a nonzero exit code

Showing Recent Errors Only

Build target PurGMCViewLibrary with configuration Debug

SwiftCompile normal arm64 Compiling\ PurGMCUnitsAvailView.swift,\ PurGMCUnitsSelectedCounterView.swift,\ PurGMCUnitsSelectedView.swift,\ PurGMCUtilsViews.swift,\ PurGMCValueViewUtils.swift,\ PurGMCViewLibrary.swift,\ PurGMCViewModifierAndShapeUtils.swift,\ PurGMCViewModifierBuilder.swift .../PurGMCViewLibrary/PurGMCUnitsAvailView.swift .../PurGMCViewLibrary/PurGMCUnitsSelectedCounterView.swift .../PurGMCViewLibrary/PurGMCUnitsSelectedView.swift .../PurGMCViewLibrary/PurGMCUtilsViews.swift .../PurGMCViewLibrary/PurGMCValueViewUtils.swift .../PurGMCViewLibrary/PurGMCViewLibrary.swift .../PurGMCViewLibrary/PurGMCViewModifierAndShapeUtils.swift .../PurGMCViewLibrary/PurGMCViewModifierBuilder.swift (in target 'PurGMCViewLibrary' from project 'PurGMCViewLibrary')

I also have a swift-front crash report (just generated from most recent build)

Looks like a bad instruction

UUID and GID of Xcode are:

drwxr-xr-x@ 3 root wheel 96 Apr 14 17:41 Xcode.app

=======================

Translated Report (Full Report Below)

Process: swift-frontend [40082] Path: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend Identifier: swift-frontend Version: ??? Code Type: ARM-64 (Native) Parent Process: SWBBuildService [36973] Responsible: Xcode [36823] User ID: 501

Date/Time: 2025-04-16 08:52:44.4410 +0300 OS Version: macOS 15.3.2 (24D81) Report Version: 12 Anonymous UUID: C92271A2-AA40-A7DF-CCE1-2FF9913E0809

Sleep/Wake UUID: 5A588A92-EF11-4C2B-B3FB-42AAF9E7FA83

Time Awake Since Boot: 53000 seconds Time Since Wake: 1161 seconds

System Integrity Protection: enabled

Crashed Thread: 0 Dispatch queue: com.apple.main-thread

Exception Type: EXC_BAD_ACCESS (SIGILL) Exception Codes: KERN_PROTECTION_FAILURE at 0x000000016d5bbfe0 Exception Codes: 0x0000000000000002, 0x000000016d5bbfe0

Termination Reason: Namespace SIGNAL, Code 4 Illegal instruction: 4 Terminating Process: swift-frontend [40082]

VM Region Info: 0x16d5bbfe0 is in 0x169db8000-0x16d5bc000; bytes after start: 58736608 bytes before end: 31 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL MALLOC_MEDIUM 160000000-168000000 [128.0M] rw-/rwx SM=PRV
GAP OF 0x1db8000 BYTES ---> STACK GUARD 169db8000-16d5bc000 [ 56.0M] ---/rwx SM=NUL stack guard for thread 0 Stack 16d5bc000-16ddb8000 [ 8176K] rw-/rwx SM=SHM thread 0

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 swift-frontend 0x103e30158 swift::InFlightSubstitution::substType(swift::SubstitutableType*, unsigned int) + 4 1 swift-frontend 0x103e35ca8 (anonymous namespace)::TypeSubstituter::transformGenericTypeParamType(swift::GenericTypeParamType*, swift::TypePosition) + 32 2 swift-frontend 0x103e31900 swift::TypeTransform<(anonymous namespace)::TypeSubstituter>::doIt(swift::Type, swift::TypePosition) + 2244 3 swift-frontend 0x103e30b4c swift::Type::subst(swift::InFlightSubstitution&) const + 976 4 swift-frontend 0x103dfc3cc swift::SubstitutionMap::get(swift::GenericSignature, llvm::ArrayRef<swift::Type>, swift::InFlightSubstitution&) + 204 5 swift-frontend 0x103dfc2cc swift::SubstitutionMap::get(swift::GenericSignature, swift::InFlightSubstitution&) + 316 6 swift-frontend 0x103e33f6c swift::TypeBase::getContextSubstitutionMap(swift::DeclContext const*, swift::GenericEnvironment*) + 380 ...

Isolated issue that caused the 16.3 non-diagnostic exit to:

import SwiftUI

struct ContainingProblemFunction<Comp:ViewModifier>: ViewModifier {

    public
    func body(content: Content) -> some View {
        EmptyView()
    }

    // WARNING: Rather doubtful this will work.
    @ViewBuilder
    private
    func apply(modifiers: [Comp], toContent content: some View) -> 
                                                                some View {
        if !modifiers.isEmpty,
           let next = modifiers.first {
            let newContent =
                ModifiedContent(content: content, modifier: next)
            if modifiers.count > 1 {
                let rest = [Comp](modifiers.dropFirst())
                apply(modifiers: rest, toContent: newContent)
            }
            else {
                newContent
            }
        }
        else {
            content
        }
    }
}

Created an unrolled workaround.

Feedback: FB17272662

Xcode 16.3 Compile fails
 
 
Q