diff options
author | JOSTAR <52376093+shenjunjiekoda@users.noreply.github.com> | 2024-12-28 18:09:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-28 11:09:29 +0100 |
commit | 8e965d89c9624c184c48806dc39d50209265f0f8 (patch) | |
tree | bfaeb185d2fa0128890bb4f5190c254840430db0 /clang/lib/AST/ByteCode/Pointer.cpp | |
parent | f2f02b21cd581057e3c9b4a7a27e0014eeb9ba15 (diff) | |
download | llvm-8e965d89c9624c184c48806dc39d50209265f0f8.zip llvm-8e965d89c9624c184c48806dc39d50209265f0f8.tar.gz llvm-8e965d89c9624c184c48806dc39d50209265f0f8.tar.bz2 |
[analyzer] Fix zext assertion failure in loop unrolling (#121203)
The current implementation of APInt extension in the code can trigger an
assertion failure when the `zext` function is called with a target width
smaller than the current bit width. For example:
```cpp
if (InitNum.getBitWidth() != BoundNum.getBitWidth()) {
InitNum = InitNum.zext(BoundNum.getBitWidth());
BoundNum = BoundNum.zext(InitNum.getBitWidth());
}
```
This logic does not guarantee that the `zext` target width is always
greater than or equal to the current bit width, leading to potential
crashes.
Expected Behavior:
- Ensure InitNum and BoundNum are extended to the maximum of their respective widths.
- Prevent assertion failures by enforcing correct `zext` usage.
Fixes #121201
Diffstat (limited to 'clang/lib/AST/ByteCode/Pointer.cpp')
0 files changed, 0 insertions, 0 deletions