Skip to content

Fix #14826 valueflow: forward lifetimes through array and member subobjects#8636

Open
francois-berder wants to merge 3 commits into
cppcheck-opensource:mainfrom
francois-berder:improve-valueflowforwardlifetime
Open

Fix #14826 valueflow: forward lifetimes through array and member subobjects#8636
francois-berder wants to merge 3 commits into
cppcheck-opensource:mainfrom
francois-berder:improve-valueflowforwardlifetime

Conversation

@francois-berder

Copy link
Copy Markdown
Collaborator

No description provided.

@francois-berder

Copy link
Copy Markdown
Collaborator Author

I also ran tools/test-my-pr on 300 packages and found no diff with main.
my_check_diff.log
my_check_diff_timing.log

@chrchr-github

Copy link
Copy Markdown
Collaborator

We should probably have a ticket for this.
Does this change affect any of these?
https://trac.cppcheck.net/ticket/13331
https://trac.cppcheck.net/ticket/13568
https://trac.cppcheck.net/ticket/14329

@francois-berder

Copy link
Copy Markdown
Collaborator Author

@chrchr-github I tried to trigger the code from tickets: 12407, 13331, 13568, 14329. Unfortunately, this PR fixed none of them so I think we need a new ticket.

@chrchr-github

Copy link
Copy Markdown
Collaborator

@chrchr-github I tried to trigger the code from tickets: 12407, 13331, 13568, 14329. Unfortunately, this PR fixed none of them so I think we need a new ticket.

Thanks for checking, I have created https://trac.cppcheck.net/ticket/14826

@danmar

danmar commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

I have created https://trac.cppcheck.net/ticket/14826

@francois-berder can you please update the PR title.

@francois-berder francois-berder changed the title valueflow: forward lifetimes through array and member subobjects Jun 20, 2026
@francois-berder francois-berder force-pushed the improve-valueflowforwardlifetime branch from e3afc01 to ce643cb Compare June 20, 2026 10:47
@francois-berder

Copy link
Copy Markdown
Collaborator Author

I have created https://trac.cppcheck.net/ticket/14826

@francois-berder can you please update the PR title.

Done

danmar
danmar previously approved these changes Jun 22, 2026
Comment thread lib/valueflow.cpp Outdated
Comment on lines +2036 to +2037
std::vector<const Token*> parents = getLhsLifetimeParents(parent->astOperand1(), settings.library);
for (const Token *p : parents)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest

Suggested change
std::vector<const Token*> parents = getLhsLifetimeParents(parent->astOperand1(), settings.library);
for (const Token *p : parents)
for (const Token *p : getLhsLifetimeParents(parent->astOperand1(), settings.library))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants