Skip to content

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

Closed
wants to merge 9 commits into from
Closed

Interpreter #267

wants to merge 9 commits into from

Conversation

dcattaruzza
Copy link
Contributor

No description provided.

Copy link
Collaborator

@tautschnig tautschnig left a 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);
}
Copy link
Collaborator

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()
Copy link
Collaborator

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>
Copy link
Collaborator

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);
Copy link
Collaborator

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();
Copy link
Collaborator

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;
Copy link
Collaborator

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
Copy link
Collaborator

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) {
Copy link
Collaborator

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);

Copy link
Collaborator

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);
}
Copy link
Collaborator

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().

@peterschrammel
Copy link
Member

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

smowton pushed a commit to smowton/cbmc that referenced this pull request May 9, 2018
…-evs-pretty-printer

SEC-105 Update pretty printer for access path new location
chrisr-diffblue added a commit to chrisr-diffblue/cbmc that referenced this pull request Aug 24, 2018
…gression-tests

Fix dependence graph regression tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants