-
Notifications
You must be signed in to change notification settings - Fork 274
Make re-building __CPROVER_initialize safe #6576
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
Make re-building __CPROVER_initialize safe #6576
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #6576 +/- ##
===========================================
+ Coverage 76.20% 76.21% +0.01%
===========================================
Files 1579 1578 -1
Lines 181291 181378 +87
===========================================
+ Hits 138144 138237 +93
+ Misses 43147 43141 -6
Continue to review full report at Codecov.
|
24a68ed
to
eaa6568
Compare
eaa6568
to
e7c87e9
Compare
eb58e07
to
907a214
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.
Approving changes in our contract module.
if(parent.get_goto_functions().function_map.erase(INITIALIZE_FUNCTION) != 0) | ||
{ | ||
static_lifetime_init( | ||
parent.get_symbol_table(), | ||
parent.get_symbol_table().lookup_ref(INITIALIZE_FUNCTION).location); | ||
goto_convert( | ||
INITIALIZE_FUNCTION, | ||
parent.get_symbol_table(), | ||
parent.get_goto_functions(), | ||
log.get_message_handler()); | ||
parent.get_goto_functions().update(); | ||
} |
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.
Nice! It'll remove unnecessary warnings from our proofs with contracts.
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 :-)
@@ -44,7 +44,7 @@ std::string c2cpp(const std::string &s) | |||
|
|||
void cpp_internal_additions(std::ostream &out) | |||
{ | |||
out << "# 1 \"<built-in-additions>\"" << '\n'; | |||
out << "#line 1 \"<built-in-additions>\"" << '\n'; |
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.
Good catch!
CHECK_RETURN(zi.has_value()); | ||
|
||
// Add the array to the symbol table. | ||
symbolt array_sym; |
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.
Mildly a shame there isn't a constructor/utility function for creating a suitably initialised symbolt
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.
Thank you for calling this out! I'll try to address this in a separate PR.
Update the symbol table and auto-generate __CPROVER_initialize instead of hand-tweaking the function. This will ensure that any further rebuilding of __CPROVER_initialize preserves those changes.
Update the symbol table and auto-generate __CPROVER_initialize instead of hand-tweaking the function. This will ensure that any further rebuilding of __CPROVER_initialize preserves those changes.
Update the symbol table and auto-generate __CPROVER_initialize instead of hand-tweaking the function. This will ensure that any further rebuilding of __CPROVER_initialize preserves those changes.
Update the symbol table and auto-generate __CPROVER_initialize instead of hand-tweaking the function. This will ensure that any further rebuilding of __CPROVER_initialize preserves those changes.
Do not fix up the value by tweaking __CPROVER_initialize. This simplifies the code and allows us to regenerate __CPROVER_initialize at any time (at least as far as __CPROVER_malloc_may_fail and __CPROVER_malloc_failure_mode are concerned). This change also avoids any cost of variables to be processed by program analysis when they are compile-time constants. This, in turn, entails updates to various goto-analyzer tests. These updates include removal of redundant patterns.
We sometimes used # 1 instead of #line 1, which GCC accepts, but Visual Studio might not actually do, or perhaps sometimes does. It certainly failed when used with the code in cprover_library.cpp.
907a214
to
e631369
Compare
Remove deprecated calls to initiallize malloc_may_fail variables. This feature is now handled differently in CBMC, see: diffblue/cbmc#6576 Signed-off-by: František Nečas <[email protected]>
Add missing symbolt include Remove usage of deprecated goto_instructiont::get_assign() Remove usage of deprecated goto_instructiont::get_function_call() Add missing include for side_effect_exprt Fix usage of goto_instructiont::source_location Fix usage of goto_instructiontt:type Update usage of goto_checkt Remove deprecated calls to initiallize malloc_may_fail variables. This feature is now handled differently in CBMC, see: diffblue/cbmc#6576 Make tests containing argc less strict, the C standard does not guarantee that it is >= 1, just that it is non-negative. For more information, refer to the CBMC commit: 788cb496ee573cc4182273d1513c5a5eb68a383a Make use of refactored update_assumptions_assertions of goto_check Adjust heap domain to newly returned annotated_pointer_constant type. For more information about this constant, see CBMC commit: 112f1d0aaa5a4606aa0e6a06a9e1ee853ebc20ab Update goto_check includes Add removed make_assertions_false to preprocessing Fix goto_check usage Remove direct access to goto_instructiont::guard Do not use soon-to-be-deprecated goto_instructiont::get_code Fix collection of record free variables Remove usage of base_type, it's deprecated Signed-off-by: František Nečas <[email protected]>
We auto-generate
__CPROVER_initialize
, but also have/had several places that tweak the generated function. Such tweaking could be lost when rebuilding__CPROVER_initialize
. The commits in this PR make sure that rebuilding__CPROVER_initialize
is safe by making the prior tweaks permanent through updates to the symbol table.