Description
Description
I strongly suspect that this is a duplicate of something already reported, but I wasn't able to locate the historical stem.
The attached file Data.swift.zip defines a static, literal [[Int]]
array of roughly 100_000 x 2 elements. Attempting to compile it seems to lead to exponential behavior in the compiler, consuming 100G or more of memory and eventually causing "out of application memory" warnings and then a system crash. (This is on macOS; I have no reason to think the bug is anything more specific than "the compiler uses too much memory.")
I would anticipate problems if the compiler were tasked with inferring the type of this array, but the problem happens when the type is already fully specified. The compiler actually handles the situation more gracefully if the type is left unspecified ("unable to infer type in reasonable time").
Here's the general shape of the declaration:
let myData: [[Int]] = [[1,2], [3,4], ... ]
The static array should amount to several MB of compiled data. The observed behavior equates to several orders of magnitude more than this in terms of parsing or compilation overhead.
Reproduction
Just compile the file and observe the memory consumption of the compiler as it chews away.
Expected behavior
Ideally, this file would just compile. But at minimum, if the compilation overhead is beyond some threshold of reasonability in terms of memory, the compiler should emit an error and abort. It's reasonable for there to be some limit on the size of a literal, but it's surprising that the functional limit is so low.
Environment
swift-driver version: 1.115.1 Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
Target: arm64-apple-macosx15.0
Additional information
No response