-
Notifications
You must be signed in to change notification settings - Fork 274
Default fall-through for function pointer removal #4646
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
Default fall-through for function pointer removal #4646
Conversation
9a94418
to
00f4b18
Compare
// fall-through | ||
if(add_safety_assertion) | ||
{ | ||
goto_programt::targett t = | ||
new_code_gotos.add(goto_programt::make_assertion(false_exprt())); | ||
t = new_code_gotos.add(goto_programt::make_assertion(false_exprt())); |
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.
FWIW there should probably be an assume(false)
after this as well.
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.
I do agree with this as it would be consistent with what happens with loop-unwinding assertions (where we add the negated loop condition to the path condition). This would effectively simplify the change here as you'd just unconditionally add the assumption below.
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 is a very good catch, but I'd agree with what @hannes-steffenhagen-diffblue said, so please fix this before merging the change.
// fall-through | ||
if(add_safety_assertion) | ||
{ | ||
goto_programt::targett t = | ||
new_code_gotos.add(goto_programt::make_assertion(false_exprt())); | ||
t = new_code_gotos.add(goto_programt::make_assertion(false_exprt())); |
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.
I do agree with this as it would be consistent with what happens with loop-unwinding assertions (where we add the negated loop condition to the path condition). This would effectively simplify the change here as you'd just unconditionally add the assumption below.
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.
No changes needed other than the ones already requested.
When the pointer points to neither of the candidates we shouldn't just call the first one (which does happen if the user does not request pointer-check). This PR inserts an ASSUME (false) which makes all subsequent assertions unreachable (and thus reported as not being violated). A small regression test is included.
00f4b18
to
eaa73cb
Compare
When the pointer points to neither of the candidates we shouldn't just call the
first one (which does happen if the user does not request pointer-check). This
PR inserts an ASSUME (false) which makes all subsequent assertions
unreachable (and thus reported as not being violated).
A small regression test is included.