-
Notifications
You must be signed in to change notification settings - Fork 273
enabling #pragma disable "pointer-primitive"
#6395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enabling #pragma disable "pointer-primitive"
#6395
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor comment below
CORE | ||
main.c | ||
--pointer-primitive-check | ||
^\*\* 0 of 2 failed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern seems a bit fragile -- the 2
checks come from malloc
but if the library implementation changes, that number could be different in the future.
I think just checking VERIFICATION SUCCESSFUL
, as you are already doing below, should suffice?
We need this to unblock some of the loop-contracts work. Can someone take a look? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. If you really want to gold plate it you could have something that fails the --pointer-primitive-check
outside of the area covered by the #pragma
.
@jimgrundy HTH but note that there are currently regression failures of this PR and it cannot be merged until those are resolved. |
I had hoped to get some clarification on the use-case. |
will do |
Should have been more specific. I was hoping one of "us" would be prompted to take a look at it, at least to get those build fails fixed so we can talk about merging. |
@kroening "The _CPROVER-prefixed pointer primitives are not really meant to be used in user-code, so why would one want to have checks for them?". Well, yes, sure. But in a way we're agreeing with you here by asking for a way to shut them off for selected code. Why do we turn them on globally in the first place though I guess would be a reasonable question. If we never turned them on globally with a command-line flag we wouldn't need a pragma to turn them off locally. One might ask more generally why these checks were implemented in the first place. I think the answer is that we find that these checks can point out misunderstandings in the instrumentation code that we generate and so we've grown to like them. However, there are times when in local sections we feel like we know what we are doing and would be better served by turning them off. More generally, there are a number of checks that can be enabled globally via a command-line flag and disabled locally with a pragma. This one has been the odd one out in that you can enable it globally but not disable it locally. It just seems that for consistency they should all work the same. |
8f1620d
to
bcae2f2
Compare
…bled using pragmas.
bcae2f2
to
9c875f2
Compare
Codecov Report
@@ Coverage Diff @@
## develop #6395 +/- ##
========================================
Coverage 75.97% 75.97%
========================================
Files 1523 1523
Lines 164191 164191
========================================
+ Hits 124748 124752 +4
+ Misses 39443 39439 -4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM; thanks!
@kroening Has your question been answered? Also are you the one that approval is now waiting on? |
Fixes #6239.
This PR enables
#pragma disable "pointer-primitive"
by adding "pointer-primitive" to the list of named checks accepted by the ansi-c lexer, to allow users to disable pointer primitive checks using pragmas embedded in C code. This addresses issue #6239. Thegoto_check
function already handles "disable:pointer-primitive-check" so only a lexer modification was needed.