diff options
author | Corentin Jabot <corentinjabot@gmail.com> | 2023-07-03 13:01:17 +0200 |
---|---|---|
committer | Corentin Jabot <corentinjabot@gmail.com> | 2023-07-28 14:38:22 +0200 |
commit | 45ab2b48bd55e50a86f6026ed31d2b60a118bdce (patch) | |
tree | 2da564aea88b66615a4ebce57f0f4b80d7a48a59 /llvm/lib/Bitcode/Reader/BitReader.cpp | |
parent | a457067d2c6b3416233d67e280c9b73dc170da46 (diff) | |
download | llvm-45ab2b48bd55e50a86f6026ed31d2b60a118bdce.zip llvm-45ab2b48bd55e50a86f6026ed31d2b60a118bdce.tar.gz llvm-45ab2b48bd55e50a86f6026ed31d2b60a118bdce.tar.bz2 |
[Clang] Improve the handling of large arrays evaluation.
This is a temporary fix (for clang 17) that caps the size of
any array we try to constant evaluate:
There are 2 limits:
* We cap to UINT_MAX the size of ant constant evaluated array,
because the constant evaluator does not support size_t.
* We cap to `-fconstexpr-steps` elements the size of each individual
array and dynamic array allocations.
This works out because the number of constexpr steps already limits
how many array elements can be initialized, which makes this new
limit conservatively generous.
This ensure that the compiler does not crash when attempting to
constant-fold valid programs.
If the limit is reached by a given array, constant evaluation will fail,
and the program will be ill-formed, until a bigger limit is given.
Or, constant folding will fail and the array will be evaluated at runtime.
Fixes #63562
Reviewed By: efriedma
Differential Revision: https://reviews.llvm.org/D155955
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitReader.cpp')
0 files changed, 0 insertions, 0 deletions