-
Notifications
You must be signed in to change notification settings - Fork 277
Interpreter #267
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
Interpreter #267
Conversation
Added dead command to trace
including: bitwise operations variable size arrays dereferencing dead objects dynamical objects input enumeration (trace backtracking)
Avoid crash from infinite array size
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 far from a complete review, but some first hints on what should be changed/updated. Once this is rebased and lint-cleaned, a full review needs to happen.
default: { | ||
out << "unknown type: " << type << std::endl; | ||
assert(false); | ||
} |
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'm generally in favour of omitting the "default" clause when all cases are covered, so as to let the compiler warn about this. But that view isn't necessarily shared by others.
That said: the placement of { and } does not match coding guidelines.
@@ -154,6 +154,12 @@ class goto_tracet | |||
steps.push_back(step); | |||
} | |||
|
|||
//Retrieves the final step in the trace | |||
inline goto_trace_stept &get_last_step() |
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 need to use "inline" within class definition.
#include <algorithm> | ||
#include <string.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.
Use cstring, not string.h
@@ -31,8 +41,41 @@ Function: interpretert::operator() | |||
|
|||
void interpretert::operator()() | |||
{ | |||
show=true; | |||
message->status() << "0- Initialize:" << messaget::eom; | |||
initialise(true); |
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.
At some point it was agreed to use American English across the code base, so please use "initialize".
{ | ||
message->error() << e << messaget::endl << messaget::eom; | ||
} | ||
while(!done) command(); |
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.
So the first error will be caught, but further errors won't?
} | ||
else | ||
{ | ||
return false; |
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.
You may just want to use has_prefix(...) instead of this function
@@ -136,27 +336,35 @@ void interpretert::step() | |||
{ | |||
PC=call_stack.top().return_PC; | |||
function=call_stack.top().return_function; | |||
stack_pointer=call_stack.top().old_stack_pointer; | |||
//stack_pointer=call_stack.top().old_stack_pointer; | |||
//TODO: this increases memory size quite quickly. Should check alternatives |
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.
Should this be fixed right away?
const struct_typet &struct_type=to_struct_type(real_type); | ||
const struct_typet::componentst &components=struct_type.components(); | ||
for(struct_typet::componentst::const_iterator it=components.begin(); | ||
it!=components.end();++it) { |
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.
Use ranged for
/* Used to determine whether or not an identifier can be built | ||
* before trying and getting an exception */ | ||
static bool can_build_identifier(const exprt &src); | ||
|
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 don't understand those changes.
return static_cast<const member_exprt &>(op).symbol(); | ||
} | ||
return to_symbol_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.
The root object need not be a symbol - it could, for example, be an array. Use object_descriptor_exprt to compute the root_object().
This PR has been superseded by the interpreter improvements in test-gen-support. Changes should be back-ported from there if desired. I keep this here as a reminder: #659 |
…-evs-pretty-printer SEC-105 Update pretty printer for access path new location
…gression-tests Fix dependence graph regression tests
No description provided.