Repository navigation
Commit 05ff791
Fix #15218 (ValueFlow: wrong lifetime values for non-local variables accross functions) (cppcheck-opensource#9014)
valueFlowForwardLifetime: do not forward lifetime of non-local variable
past end of function
For a global variable the scope body end is null so the lifetime was
forwarded through the rest of the file, into unrelated functions.
colobot restext.cpp: ValueFlow 615s => 5s.
In 10000 Debian packages (--check-level=exhaustive) this removes 11
false positives (danglingLifetime, objectIndex) and adds no warnings.
Co-authored-by: Daniel Marjamäki <daniel.marjamaki@cppcheck.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>1 parent 42c9edd commit 05ff791
2 files changed
Lines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2014 | 2014 | | |
2015 | 2015 | | |
2016 | 2016 | | |
| 2017 | + | |
| 2018 | + | |
| 2019 | + | |
| 2020 | + | |
| 2021 | + | |
| 2022 | + | |
2017 | 2023 | | |
2018 | 2024 | | |
2019 | 2025 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
831 | 839 | | |
832 | 840 | | |
833 | 841 | | |
| |||
0 commit comments