You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In intptr_t expressions llvm generally picks the left hand side as providing provenance and warns about it. It would be nice if an analyzer could look deeper (across function boundaries, etc) and determine:
if the result of the expression is ever used in a context where provenance is required
which arguments could carry provenance in practice
determine which subtractions would produce ptrdiff_t is the expressions were char * rather than intptr_t
It could then use that too suggest changes to clarify the programmer's intent rather than just saying it's ambiguous.
Note: this needs to be a static analyzer (possibly whole-program) rather than the compiler, because compiler analysis will depend too much on optimization levels at the like.
The text was updated successfully, but these errors were encountered:
I now have a CSA checker that can detect the first two issues (PR #675).
I don't quite understand the third suggestion though (about ptrdiff_t), what the pattern is and why this can be a problem. Could you please give an example or share the link to the commit that addresses this issue in some ported project?
In
intptr_t
expressions llvm generally picks the left hand side as providing provenance and warns about it. It would be nice if an analyzer could look deeper (across function boundaries, etc) and determine:ptrdiff_t
is the expressions werechar *
rather thanintptr_t
It could then use that too suggest changes to clarify the programmer's intent rather than just saying it's ambiguous.
Note: this needs to be a static analyzer (possibly whole-program) rather than the compiler, because compiler analysis will depend too much on optimization levels at the like.
The text was updated successfully, but these errors were encountered: