[clang] [-Wunsafe-buffer-usage] Add alloc_size knowledge to the 2-param span constructor warning (PR #114894)
David Tarditi via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 7 16:49:53 PST 2025
================
----------------
dtarditi wrote:
I agree that it is fine to not handle this for now.
If we do decide to handle this, we need to be careful because this equivalence does not hold for signed integer arithmetic expressions in C. The equivalence relies on commutativity and associativity of integer arithmetic. Reassociation can change whether overflow occurs for integer expressions at runtime and signed integer overflow is undefined behavior in C. If, however, we assume that signed integer arithmetic is 2's complement arithmetic (which can be specified via a compiler flag), then this equivalence holds for signed integer expressions.
https://github.com/llvm/llvm-project/pull/114894
More information about the cfe-commits
mailing list