Skip to content

goto-instrument --model-argc-argv: Explicitly initialise argc, argv #55

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
Jan 20, 2017

Conversation

tautschnig
Copy link
Collaborator

Programs using argc and argv need to have these set up properly. This patch introduces an instrumentation achieving this.

return false;
}

// set the size of ARGV storage to 4096, which matches the minium
Copy link
Member

Choose a reason for hiding this comment

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

minimum

@@ -0,0 +1,157 @@
/*******************************************************************\
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this C-specific and should therefore go into ansi-c/ ?
A language-independent version would be appreciate so that it works also for Java.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It currently indeed is C specific, and the updated version includes an explicit check for mode==ID_C. I would, however, appreciate any work for supporting Java.

// add __CPROVER_assume if necessary (it might exist already)
if(it->first=="__CPROVER_assume")
symbol_table.add(it->second);
else if(it->first=="__CPROVER_initialize")
Copy link
Member

Choose a reason for hiding this comment

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

What happens to the global variable initializations?

@kroening
Copy link
Member

I think this looks good and just needs a rebase.

Warn when --model-argc-argv is used for main functions without arguments
@tautschnig
Copy link
Collaborator Author

I have addressed all comments, rebased, and added a regression test. That test, however, is only truly meaningful once #453 is merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants