mirror of
https://github.com/Z3Prover/z3
synced 2026-08-02 12:13:25 +00:00
Fix clang-tidy dead store warnings in util.cpp and model_based_opt.cpp (#10334)
Three `clang-analyzer-deadcode.DeadStores` warnings flagged by
clang-tidy: redundant bit-shifts in the log2 functions and an
unreachable assignment in `def::from_row()`.
## Changes
- **`src/util/util.cpp`** — `log2()` and `uint64_log2()`: Remove `v >>=
1` in the final `if (v & 0x2)` block. Only `r |= 1` matters; `v` is
never read after that point.
```cpp
// Before
if (v & 0x2) {
v >>= 1; // dead store
r |= 1;
}
// After
if (v & 0x2) {
r |= 1;
}
```
- **`src/math/simplex/model_based_opt.cpp`** — `def::from_row()`: Remove
`sign = true` assignment when `div < 0`. `sign` is only consumed earlier
in the function (`if (!sign)`) and is not read again after this point.
<!-- START COPILOT CODING AGENT SUFFIX -->
- Fixes #10333
---------
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
6212042e80
commit
00de81166d
2 changed files with 0 additions and 3 deletions
|
|
@ -73,7 +73,6 @@ namespace opt {
|
|||
}
|
||||
|
||||
if (div < 0) {
|
||||
sign = true;
|
||||
div.neg();
|
||||
lc.neg();
|
||||
coeff.neg();
|
||||
|
|
|
|||
|
|
@ -86,7 +86,6 @@ unsigned log2(unsigned v) {
|
|||
r |= 2;
|
||||
}
|
||||
if (v & 0x2) {
|
||||
v >>= 1;
|
||||
r |= 1;
|
||||
}
|
||||
return r;
|
||||
|
|
@ -115,7 +114,6 @@ unsigned uint64_log2(uint64_t v) {
|
|||
r |= 2;
|
||||
}
|
||||
if (v & 0x2) {
|
||||
v >>= 1;
|
||||
r |= 1;
|
||||
}
|
||||
return r;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue