-
Notifications
You must be signed in to change notification settings - Fork 273
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
Fix up symbol naming checks so --validate-goto-model can be enabled in regression testing. #3767
Fix up symbol naming checks so --validate-goto-model can be enabled in regression testing. #3767
Conversation
a8f7384
to
d877f19
Compare
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: 25b5339).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97112409
25b5339
to
eec235f
Compare
8bf6b77
to
94da2fc
Compare
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: 94da2fc).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97410307
94da2fc
to
95bfb7d
Compare
Just noting that this will help us close out #2734, where I complained about the missing test. |
Good spot! |
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: 95bfb7d).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/97418621
95bfb7d
to
4c699cf
Compare
src/goto-programs/goto_program.cpp
Outdated
@@ -14,6 +14,7 @@ Author: Daniel Kroening, [email protected] | |||
#include <ostream> | |||
#include <iomanip> | |||
|
|||
#include <goto-programs/remove_returns.h> |
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'd prefer #include "remove_returns.h"
and placing that at the bottom of the list of includes, for consistency with how that's done in other files.
And a nit-pick: s/differnet/different/ in the commit message.
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.
Fixed.
src/goto-programs/goto_program.cpp
Outdated
// type of the function and use that full type to check | ||
// consistency with the goto program | ||
auto full_table_symbol_type = to_code_type(table_symbol->type); | ||
full_table_symbol_type.return_type() = return_value_symbol->type; |
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 can be simplified by using original_return_type
(from remove_returns.{h,cpp}
).
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.
Thanks - I did actually look for a utility function to use here, but somehow managed to miss that. I much appreciate the pointer.
Some smaller suggestions for improvement above, but otherwise I'd suggest to merge this as soon as possible. |
The symbol naming check added in df616e4 attempts to assert that the 'base_name' of a symbol is a suffix of that symbol's 'name'. In general, this should be the case, but there are certain classes of symbols where this does not currently hold. This commit adds special cases to handle: * Type symbols that are typedefs or tags * Symbols that have been renamed by the linker With these special cases handled, it is possible to run the CORE regression tests with --validate-goto-model enabled.
…ified types Return removal sets the return type of a function symbol table entry to 'void', but some callsites still expect the original type (e.g. if a function is passed as a parameter to a different function)
…types When a function declaration and its definition appear in different translation units they may have different return types. This commit relaxes the checks in goto_programt::instructiont::validate() in these circumstances.
This will prevent the introduction of changes that violate the checks in the goto-validation procedure.
a6b3123
to
933c2ef
Compare
I'll wait for CI to pass, then merge if nobody else wants to block it. |
The function-type mismatch due to declaration vs. definition inconsistency smells a bit off. Is there future work to figure out why that results in a symbol-table vs. goto-program type clash? |
@smowton I don't have a fixed plan to dig into that deeper, but yes, I'd like to at some point - though its the kind of code that, say, GCC will compile relatively happily... |
@smowton @chrisr-diffblue The goto-program linker permits various type inconsistencies to compile (poor) real-world C code. Some of it is fixed up by casts done in symbolic execution, other bits are fixed via |
OK, CI has passed, so I'm going to hit merge. If anyone feels strongly that I shouldn't have relaxed the check declaration vs. definition check, I can sort that out in a different PR. |
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: 933c2ef).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/98841367
As a follow up to diffblue#3767 and to keep naming consistency between C and Java.
As a follow up to #3767 and to keep naming consistency between C and Java.
As a follow up to diffblue#3767 and to keep naming consistency between C and Java.
As a follow up to diffblue#3767 and to keep naming consistency between C and Java.
This PR supersedes #3661 by taking the first commit in that PR (which makes regression tests run with --validate-goto-program) and then the subsequent commits in this PR fix up a few places that causes regression tests to fail. The final commit in this PR adds a few special cases to the
symbol.is_well_formed()
check that was previously added in #3193.I have a few concerns about these additional 'special cases' - so I'd welcome feedback on those - they feel a bit like a breaking of abstraction.
@kroening Feel free to either cherry-pick commits from this PR into #3661, or close that and focus on this PR instead. As mentioned by @tautschnig - this PR also supersedes/compliments #2734 as well.