Skip to content
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

Added modifies clause generation for Boogie files. #267

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open

Added modifies clause generation for Boogie files. #267

wants to merge 17 commits into from

Conversation

liammachado
Copy link
Contributor

Modifies clause generation is now directly integrated into the SMACK tool, rather than being done by Corral/Boogie.

@zvonimir zvonimir self-requested a review October 6, 2017 18:31
Copy link
Member

@zvonimir zvonimir left a comment

Choose a reason for hiding this comment

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

More to come.

CMakeLists.txt Outdated
@@ -175,6 +175,7 @@ add_library(smackTranslator STATIC
include/smack/MemorySafetyChecker.h
include/smack/SignedIntegerOverflowChecker.h
include/smack/SplitAggregateLoadStore.h
include/smack/GenModifies.h
Copy link
Member

Choose a reason for hiding this comment

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

I think that naming this file ModAnalysis would be better. So update its name.

//
// This file is distributed under the MIT License. See LICENSE for details.
//
#ifndef MODS_H
Copy link
Member

Choose a reason for hiding this comment

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

Change the file name to ModAnalysis.h.
Also, this should be #ifndef MODANALYSIS_H to make it consistent with other files.

// This file is distributed under the MIT License. See LICENSE for details.
//
#ifndef MODS_H
#define MODS_H
Copy link
Member

Choose a reason for hiding this comment

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

See above comment. Change this to MODANALYSIS_H

@@ -512,7 +512,7 @@ def verify_bpl(args):
elif args.verifier == 'boogie' or args.modular:
command = ["boogie"]
command += [args.bpl_file]
command += ["/nologo", "/noinfer", "/doModSetAnalysis"]
#command += ["/nologo", "/noinfer", "/doModSetAnalysis"]
Copy link
Member

Choose a reason for hiding this comment

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

Don't comment this whole line out. Just remove /doModSetAnalysis


void GenModifies::genUserCodeModifies(Program *program, const std::set<std::string> &bplGlobals) {
genSCCs(program);

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line, it is not needed here.

std::string modClause = getBplGlobalsModifiesClause(bplGlobals);

fixPrelude(program, modClause);

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line, it is not needed here.

if (isa<CodeDecl>(decl)) {
if (PROC_DECL.match(decl->getName()) && !MOD_CL.match(decl->getName())) {
std::string newStr = PROC_DECL.sub("\\1", decl->getName()) + modClause + PROC_DECL.sub("\\3", decl->getName());

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line, it is not needed here.


void GenModifies::fixPrelude(Program *program, const std::string &modClause) {
std::string searchStr = "procedure $global_allocations()\n";

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line, it is not needed here.

std::string searchStr = "procedure $global_allocations()\n";

std::string &prelude = program->getPrelude();

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line, it is not needed here.

if (pos != std::string::npos) {
std::string str1 = prelude.substr(0, pos + searchStr.size());
std::string str2 = prelude.substr(pos + searchStr.size());

Copy link
Member

Choose a reason for hiding this comment

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

Remove this empty line, it is not needed here.

…ry-safety regtests to fail.

The modifies pass was not handling the prelude section of Boogie files.
When the --memory-safety option is specified, this prelude section
contains a procedure called $global_allocations which modifies some
variables. Additionally, the modifies pass only adds modifies
clauses to SMACK-generated procedures that do not already have one, which
does not cover the $malloc procedure when the --memory-safety option is
set. This is directly changed in smack.c.
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.

2 participants