Command line swiftc: 0: remark: did not find a prebuilt standard library for target 'x86_64-apple-macos' compatible with this Swift compiler;

Compile very simple code but with large array static initialization:

let array: [Foo] = [
.init(....),
// thousands .init here
]

compile took a very long time (why such long compile time for this?) and ends with:

swiftc containfilter.swift
:0: remark: did not find a prebuilt standard library for target 'x86_64-apple-macos' compatible with this Swift compiler; building it may take a few minutes, but it should only happen once for this combination of compiler and target

swiftc --version

Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)

the swiftc actually produce an executable output, but running it prints:

zsh: segmentation fault

when this same very large array code is compile as part of Xcode(Version 13.3 (13E113)) SwiftUI project, compile also takes a very long time and sometimes fail with:

Screen Shot 2022-03-23 at 11.35.25 AM

but most of time compile fine.

command line swiftc compile this is fine:

print("Hello")

what's wrong? how to fix?

My code: containfilter.swift ยท GitHub

Edit: compiler should not produce executable that seg fault. I file a bug: [SR-16086] Command line swiftc compile executable segmentation fault - Swift