This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Fix assertion on casting SVal to NonLoc inside the IteratorRange checker
ClosedPublic

Authored by steakhal on Aug 28 2023, 12:48 AM.

Details

Summary

The checker assumed that it could safely cast an SVal to Nonloc.
This surfaced because, with std::ranges, we can unintentionally match
on other APIs as well, thus increasing the likelihood of violating
checker assumptions about the context it's invoked.
https://godbolt.org/z/13vEb3K76

See the discourse post on CallDescriptions and std::ranges here.
https://discourse.llvm.org/t/calldescriptions-should-not-skip-the-ranges-part-in-std-names-when-matching/73076

Fixes https://github.com/llvm/llvm-project/issues/65009

Diff Detail

Event Timeline

steakhal created this revision.Aug 28 2023, 12:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2023, 12:48 AM
steakhal requested review of this revision.Aug 28 2023, 12:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 28 2023, 12:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
steakhal edited the summary of this revision. (Show Details)Aug 28 2023, 12:50 AM
donat.nagy accepted this revision.Aug 28 2023, 1:29 AM

LGTM. I'm not familiar with the Iterator checker family, but this is a very straightforward change.

This revision is now accepted and ready to land.Aug 28 2023, 1:29 AM

LGTM. I'm not familiar with the Iterator checker family, but this is a very straightforward change.

Thanks for the review!
Well, it's an Ericsson checker ;)