C++: Implement isUnreachableInCall#13603
Merged
MathiasVP merged 6 commits intogithub:mainfrom Jun 30, 2023
Merged
Conversation
Contributor
Author
|
DCA looks good: performance looks unchanged, and it's removing a small amount of FPs in various queries. |
jketema
reviewed
Jun 30, 2023
Contributor
jketema
left a comment
There was a problem hiding this comment.
Two small comments, otherwise LGTM.
| | test.cpp:136:9:136:16 | PointerAdd: ... += ... | test.cpp:143:18:143:21 | asdf | test.cpp:138:13:138:15 | arr | This pointer arithmetic may have an off-by-2 error allowing it to overrun $@ at this $@. | test.cpp:142:10:142:13 | asdf | asdf | test.cpp:138:12:138:15 | Load: * ... | read | | ||
| | test.cpp:151:5:151:11 | PointerAdd: access to array | test.cpp:148:23:148:28 | buffer | test.cpp:151:5:151:11 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:147:19:147:24 | buffer | buffer | test.cpp:151:5:151:15 | Store: ... = ... | write | | ||
| | test.cpp:162:5:162:10 | PointerAdd: access to array | test.cpp:159:25:159:29 | array | test.cpp:162:5:162:10 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:158:10:158:14 | array | array | test.cpp:162:5:162:19 | Store: ... = ... | write | | ||
| | test.cpp:191:27:191:30 | PointerAdd: access to array | test.cpp:201:14:201:20 | buffer2 | test.cpp:191:27:191:30 | access to array | This pointer arithmetic may have an off-by-1 error allowing it to overrun $@ at this $@. | test.cpp:200:19:200:25 | buffer2 | buffer2 | test.cpp:191:27:191:30 | Load: access to array | read | |
Contributor
There was a problem hiding this comment.
I think the test annotation needs to be updated too.
Contributor
Author
There was a problem hiding this comment.
There's still a FP on that line, so we can't really remove the annotation. The annotation in question is:
// GOOD [FALSE POSITIVE]: `call_use(buffer2, 2)` won't reach this point.and this PR manages to remove the FP when the call originates from this source:
unsigned char buffer2[2];
call_use(buffer2,2);but not from this source:
unsigned char buffer2[2];
call_call_use(buffer2,2);
Contributor
There was a problem hiding this comment.
Oh, great, test confusion.
Co-authored-by: Jeroen Ketema <93738568+jketema@users.noreply.github.com>
jketema
approved these changes
Jun 30, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
isUnreachableInCallmakes use of the already-existing call context computed in the dataflow library to rule out infeasible dataflow paths in a function body based on the passed arguments.IIRC, @aschackmull mentioned that the implementation of this feature inside the dataflow library isn't super efficient, so I'm marking this as a draft while we run DCA to estimate the cost of this vs. the benefits provided (I'm looking at you FPs in
cpp/constant-array-overflow!)