[SR-9373] Clang importer should refuse to import arrays with excessive numbers of elements #51839
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
good first issue
Good for newcomers
Additional Detail from JIRA
md5: ceda7a47d94b61660b417b8d9c1437e5
Issue Description:
The Swift importer will blindly try to create an N-element tuple for C arrays of size N. This quickly becomes ridiculous even for fairly small arrays like 16 or 32. It becomes downright pathological from a visual standpoint as the array goes past 128 or so, and at arrays past 1024 starts exhibiting semi-exponential behavior in time; generating the Swift interface for a header containing a 65536-element array takes almost 5 full minutes on a MBP. The importer should refuse to handle such large arrays.
Steps To Reproduce:
Results:
The interface takes quite a long time to generate.
Regression:
This has always been the case for as far back as the “generate N-element tuples for N-element arrays” logic has existed.
Notes:
Arrays of such excessive size are not necessarily common, but they do appear in practice. Pending a better way to import C arrays in general, especially large ones, Swift should better own its inability to handle them effectively.
The text was updated successfully, but these errors were encountered: