-
Notifications
You must be signed in to change notification settings - Fork 274
fix accesses to exprt::opX() in ansi-c/ #4983
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
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.
This seems to be removing a bunch of user-facing error messages. Either these were dead code or we are now going to produce invariant violations that can be triggered by input files, which would be entirely wrong.
@tautschnig I did think about those error messages: the conditions checked by them should be post-conditions of the parser, i.e., it should be impossible for a user to trigger these. |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 117a17c).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/121881987
Seems fair. In that case, can all the |
@tautschnig Yes, agreed -- these should be early. That will touch both the ansi-c and C++ front-ends, and we would need to think about a mechanism similar to what we've done in the simplifier. The problem is that some of the typechecking methods change the type of what's being checked. |
While that's certainly true we don't change the number of operands, do we? So using |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 79b35a6).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/121921747
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've only reviewed about the first half, but my comments seemed to repeat a lot so I think those should be addressed across the PR (or discussed and resolved) first.
Yes, we may change the number of operands, at least in some places. |
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 7e20208).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/121946683
Codecov Report
@@ Coverage Diff @@
## develop #4983 +/- ##
===========================================
+ Coverage 69.24% 69.26% +0.01%
===========================================
Files 1309 1309
Lines 108476 108430 -46
===========================================
- Hits 75117 75102 -15
+ Misses 33359 33328 -31
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.
I've resolved all the comments that won't be fixed in this PR, but some others remain open and I added a few more now that I made it through the entire PR.
src/ansi-c/c_typecheck_expr.cpp
Outdated
exprt &op0=expr.op0(); | ||
exprt &op1=expr.op1(); | ||
exprt &op0 = to_binary_expr(expr).op0(); | ||
exprt &op1 = to_binary_expr(expr).op1(); |
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 think we should do to_binary_expr
just once.
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.
done
src/ansi-c/c_typecheck_expr.cpp
Outdated
exprt &op0=expr.op0(); | ||
exprt &op1=expr.op1(); | ||
exprt &op0 = to_binary_expr(expr).op0(); | ||
exprt &op1 = to_binary_expr(expr).op1(); |
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 think we should do to_binary_expr
just once.
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.
done
DATA_INVARIANT( | ||
as_expr.operands().size() == 1, | ||
"typeof of an expression must have one operand"); | ||
exprt expr = to_unary_expr(as_expr).op(); |
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.
Why this DATA_INVARIANT
here when elsewhere we just use to_unary_expr
?
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.
removed
This improves type safety.
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.
✔️
Passed Diffblue compatibility checks (cbmc commit: 9ae4c37).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/122016024
This improves type safety.