Skip to content

Fix #15228 (valueFlowLifetime: subscripted array is not a decayed pointer) - #9039

Open
danmar wants to merge 1 commit into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-15228
Open

danmar wants to merge 1 commit into
cppcheck-opensource:mainfrom
cppchecksolutions:fix-15228

Conversation

@danmar

@danmar danmar commented Nov 17, 2026

Copy link
Copy Markdown
Collaborator

For 'arr[i]' where arr is an array of pointers, isDecayedPointer() returned true because the type of 'arr[i]' is a pointer. A lifetime value was then created and forwarded for each subscript; with many 'arr[N] = ...' statements in one function this is quadratic.

spice rop3.c: ValueFlow 352s => 28s.
In 10000 Debian packages (--check-level=exhaustive) this adds 11 warnings: 9 correct nullPointerOutOfMemory/nullPointerOutOfResources and 2 false positives (uninitvar, arrayIndexOutOfBoundsCond).

@dmcppcheck

Copy link
Copy Markdown
Contributor

There should probably be a trac ticket for this PR. Please create it, or ask us to create it. Then the PR title should be updated.

@danmar danmar changed the title valueFlowLifetime: subscripted array is not a decayed pointer Fix #15228 (valueFlowLifetime: subscripted array is not a decayed pointer) Nov 17, 2026
For 'arr[i]' where arr is an array of pointers, isDecayedPointer()
returned true because the type of 'arr[i]' is a pointer. A lifetime
value was then created and forwarded for each subscript; with many
'arr[N] = ...' statements in one function this is quadratic.

spice rop3.c: ValueFlow 352s => 28s.
In 10000 Debian packages (--check-level=exhaustive) this adds 11
warnings: 9 correct nullPointerOutOfMemory/nullPointerOutOfResources
and 2 false positives (uninitvar, arrayIndexOutOfBoundsCond).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@danmar
danmar force-pushed the fix-15228 branch 2 times, most recently from d1ed991 to 396bb75 Compare November 17, 2026 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants