Revision tags: llvmorg-21-init |
|
#
2a8c12b2 |
| 21-Jan-2025 |
Malavika Samak <malavika.samak@gmail.com> |
"Reland "[Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (#119340)"" (#123713)
This reverts commit 7dd34baf5505d689161c3a8678322a394d7a29
"Reland "[Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (#119340)"" (#123713)
This reverts commit 7dd34baf5505d689161c3a8678322a394d7a2929.
Fixed the assertion violation reported by
7dd34baf5505d689161c3a8678322a394d7a2929
Co-authored-by: MalavikaSamak <malavika2@apple.com>
show more ...
|
#
7dd34baf |
| 16-Jan-2025 |
Nico Weber <thakis@chromium.org> |
Revert "[Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (#119340)"
This reverts commit 64c2156d8802b0d7724f65ce854844670e4ec457. Causes a
Revert "[Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (#119340)"
This reverts commit 64c2156d8802b0d7724f65ce854844670e4ec457. Causes asserts, see https://github.com/llvm/llvm-project/pull/119340#issuecomment-2595858729
show more ...
|
Revision tags: llvmorg-19.1.7 |
|
#
64c2156d |
| 14-Jan-2025 |
Malavika Samak <malavika.samak@gmail.com> |
[Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (#119340)
Do not warn when constant sized array is indexed by expressions that
evaluate
[Wunsafe-buffer-usage] Fix false positive when const sized array is indexed by const evaluatable expressions (#119340)
Do not warn when constant sized array is indexed by expressions that
evaluate to a const value. For instance, sizeof(T) expression value can
be evaluated at compile time and if an array is indexed by such an
expression, it's bounds can be validated.
(rdar://140320289)
Co-authored-by: MalavikaSamak <malavika2@apple.com>
show more ...
|
Revision tags: llvmorg-19.1.6 |
|
#
9c50182b |
| 12-Dec-2024 |
Malavika Samak <malavika.samak@gmail.com> |
[-Wunsafe-buffer-usage] Suppress warning for multi-dimensional constant arrays (#118249)
Do not warn about unsafe buffer access, when multi-dimensional constant
arrays are accessed and their indice
[-Wunsafe-buffer-usage] Suppress warning for multi-dimensional constant arrays (#118249)
Do not warn about unsafe buffer access, when multi-dimensional constant
arrays are accessed and their indices are within the bounds of the
buffer. Warning in such cases would be a false positive. Such a
suppression already exists for 1-d
arrays and it is now extended to multi-dimensional arrays.
(rdar://137926311)
(rdar://140320139)
Co-authored-by: MalavikaSamak <malavika2@apple.com>
show more ...
|
Revision tags: llvmorg-19.1.5, llvmorg-19.1.4 |
|
#
da032a60 |
| 12-Nov-2024 |
Malavika Samak <malavika.samak@gmail.com> |
[Wunsafe-buffer-usage] Fix false positives in handling string literals. (#115552)
Do not warn when a string literal is indexed and the idex value is
within the bounds of the length of the string.
[Wunsafe-buffer-usage] Fix false positives in handling string literals. (#115552)
Do not warn when a string literal is indexed and the idex value is
within the bounds of the length of the string.
(rdar://139106996)
Co-authored-by: MalavikaSamak <malavika2@apple.com>
show more ...
|
Revision tags: llvmorg-19.1.3, llvmorg-19.1.2, llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5, llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3 |
|
#
9a1e6373 |
| 15-Feb-2024 |
jkorous-apple <32549412+jkorous-apple@users.noreply.github.com> |
[-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (#80504)
[-Wunsafe-buffer-usage] Ignore safe array subscripts
Don't emit warnings for array subscripts on constant size arra
[-Wunsafe-buffer-usage] Ignore constant safe indices in array subscripts (#80504)
[-Wunsafe-buffer-usage] Ignore safe array subscripts
Don't emit warnings for array subscripts on constant size arrays where the index is constant and within bounds.
Example:
int arr[10];
arr[5] = 0; //safe, no warning
This patch recognizes only array indices that are integer literals - it doesn't understand more complex expressions (arithmetic on constants, etc.).
-Warray-bounds implemented in Sema::CheckArrayAccess() already solves a similar
(opposite) problem, handles complex expressions and is battle-tested.
Adding -Wunsafe-buffer-usage diagnostics to Sema is a non-starter as we need to emit
both the warnings and fixits and the performance impact of the fixit machine is
unacceptable for Sema.
CheckArrayAccess() as is doesn't distinguish between "safe" and "unknown" array
accesses. It also mixes the analysis that decides if an index is out of bounds
with crafting the diagnostics.
A refactor of CheckArrayAccess() might serve both the original purpose
and help us avoid false-positive with -Wunsafe-buffer-usage on constant
size arrrays.
show more ...
|
#
644ac2a0 |
| 12-Feb-2024 |
jkorous-apple <32549412+jkorous-apple@users.noreply.github.com> |
[-Wunsafe-buffer-usage] Introduce std::array fixits (#80084)
Array subscript on a const size array is not bounds-checked. The idiomatic
replacement is std::array which is bounds-safe in hardened mo
[-Wunsafe-buffer-usage] Introduce std::array fixits (#80084)
Array subscript on a const size array is not bounds-checked. The idiomatic
replacement is std::array which is bounds-safe in hardened mode of libc++.
This commit extends the fixit-producing machine to consider std::array as a
transformation target type and teaches it to handle the array subscript on const
size arrays with a trivial (empty) fixit.
show more ...
|