-
Notifications
You must be signed in to change notification settings - Fork 277
goto_symex: implement SET_RETURN_VALUE #6436
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,9 +58,16 @@ bool process_goto_program( | |
} | ||
|
||
// remove returns, gcc vectors, complex | ||
remove_returns(goto_model); | ||
if( | ||
options.get_bool_option("remove-returns") || | ||
options.get_bool_option("string-abstraction")) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. String abstraction was built well before return-value removal, so I wouldn't really expect a dependency here. In 425731b I noticed a need for some fixes, but I don't think that there should be a general requirement for return-value removal to make string abstraction work. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's unclear what the effort is. Might not be worth it, given that this feature has no known users. |
||
{ | ||
remove_returns(goto_model); | ||
} | ||
|
||
remove_vector(goto_model); | ||
remove_complex(goto_model); | ||
|
||
if(options.get_bool_option("rewrite-union")) | ||
rewrite_union(goto_model); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*******************************************************************\ | ||
|
||
Module: Symbolic Execution of ANSI-C | ||
|
||
Author: Daniel Kroening, kroening@kroening.com | ||
|
||
\*******************************************************************/ | ||
|
||
/// \file | ||
/// Symbolic Execution of ANSI-C | ||
|
||
#include "goto_symex.h" | ||
|
||
void goto_symext::symex_set_return_value( | ||
statet &state, | ||
const exprt &return_value) | ||
{ | ||
// we must be inside a function that was called | ||
PRECONDITION(!state.call_stack().empty()); | ||
|
||
framet &frame = state.call_stack().top(); | ||
if(frame.return_value_symbol.has_value()) | ||
{ | ||
symex_assign(state, frame.return_value_symbol.value(), return_value); | ||
} | ||
} |
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 are the changes to
mm_io
necessary?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.
The current implementation assumes that the return value is in the function#return_value variable. It needs to be changed to use the lhs in the function call.