Skip to content

Fixes for is_threadedt, --is-threaded #1853

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

Merged
merged 1 commit into from
Feb 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions regression/goto-instrument/is-threaded1/main.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@

int x;

void func3()
{
x = 6;
}

void func2()
{
x = 3;
Expand Down
12 changes: 4 additions & 8 deletions src/analyses/is_threaded.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ class is_threaded_domaint:public ai_domain_baset
locationt from,
locationt to)
{
// assert(src.reachable);

if(!src.reachable)
return false;
INVARIANT(src.reachable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably PRECONDITION here expresses the intent clearer.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@thk123 I'm unsure... my belief is that this is enforced by a property of the AI engine; it's really an invariant of that. Hmmm... maybe it is a precondition...

Copy link
Contributor Author

@danpoe danpoe Feb 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's both a precondition of the method and a property of the AI engine, thus I used the more general INVARIANT. However, thinking about it now, maybe PRECONDITION does indeed suit better, and the fact that the AI engine does not apply transform() to bottom should be checked by an invariant in ait instead.

"Abstract states are only merged at reachable locations");

bool old_reachable=reachable;
bool old_is_threaded=is_threaded;
Expand All @@ -52,10 +50,8 @@ class is_threaded_domaint:public ai_domain_baset
transform(locationt from, locationt to, ai_baset &ai, const namespacet &ns)
final override
{
// assert(reachable);

if(!reachable)
return;
INVARIANT(reachable,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto about PRECONDITION

"Transformers are only applied at reachable locations");

if(from->is_start_thread())
is_threaded=true;
Expand Down
4 changes: 4 additions & 0 deletions src/goto-instrument/goto_instrument_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ int goto_instrument_parse_optionst::doit()
<< "\n\n";
}
}

return CPROVER_EXIT_SUCCESS;
}

if(cmdline.isset("show-value-sets"))
Expand Down Expand Up @@ -1493,6 +1495,8 @@ void goto_instrument_parse_optionst::help()
// NOLINTNEXTLINE(whitespace/line_length)
" --reachable-call-graph show graph of function calls potentially reachable from main function\n"
" --class-hierarchy show class hierarchy\n"
// NOLINTNEXTLINE(whitespace/line_length)
" --show-threaded show instructions that may be executed by more than one thread\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just documented and undocumented option, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's only documenting a previously undocumented option.

"\n"
"Safety checks:\n"
" --no-assertions ignore user assertions\n"
Expand Down