Repository navigation
Add __builtin_add_overflow primitives - #5233
NlightNFotis merged 2 commits into
Conversation
`cprover_library.inc` should depend on the *.c files, not just the converter itself.
| @@ -0,0 +1,80 @@ | |||
| #include <limits.h> | |||
| #include <assert.h> | |||
|
|
|||
There was a problem hiding this comment.
Tests look good, but could we add a few more cases? In particular, these tests only cover some of the "easily optimised" cases (e.g value of 1, adding/subtracting to MAX/MIN), but it would be great to see some tests that also cover "mid-range value x + mid-range value y == overflow" and "slightly smaller mid-range value x + mid-range value y != overflow" cases.
There was a problem hiding this comment.
@chrisr-diffblue I’ve added some more cases to that end
17dbc9f to
0de4466
Compare
Note: Not the generic version.
0de4466 to
448906f
Compare
chrisr-diffblue
left a comment
There was a problem hiding this comment.
Looks good, and thanks for expanding the tests.
Codecov Report
@@ Coverage Diff @@
## develop #5233 +/- ##
===========================================
+ Coverage 67.51% 67.51% +<.01%
===========================================
Files 1161 1161
Lines 95501 95501
===========================================
+ Hits 64479 64481 +2
+ Misses 31022 31020 -2
Continue to review full report at Codecov.
|
This addresses part of #4701. Only add primitives in this PR. Note
gccalso has a generic__builtin_add_overflowwhich isn’t implemented here. The issue also has some discussion about making overflow checks faster, this also isn’t implemented here.