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:
: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
Apple Swift version 5.6 (swiftlang-184.108.40.2063.62 clang-13220.127.116.11)
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:
but most of time compile fine.
command line swiftc compile this is fine:
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