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

Size axioms for struct constants causing inconsistencies #37

Closed
zvonimir opened this issue Feb 14, 2014 · 3 comments
Closed

Size axioms for struct constants causing inconsistencies #37

zvonimir opened this issue Feb 14, 2014 · 3 comments

Comments

@zvonimir
Copy link
Member

Problematic example is examples/svcomp/ntdrivers/floppy_unsafe.i.cil.c.
I've been working off the cleaning-alloc branch.

Using twodim, these are the two problematic axioms that get generated:
axiom ($size($obj($pa($ptr(MOUNTDEV_MOUNTED_DEVICE_GUID, 0), 12, 1))) == 8);
axiom ($size($obj($pa($ptr(MOUNTDEV_MOUNTED_DEVICE_GUID, 0), 20, 1))) == 4);

Flat model has the same problems and the axioms there are also wrong, but not inconsistent.

@zvonimir
Copy link
Member Author

Ok, root cause is in SmackRep::addInit. While initialization is by its nature recursive, setting $size is not since $size should be set only for the whole object.
One question that I have is why do we even need these lines:
program->addDecl(
Decl::axiom(
Expr::eq(
Expr::fn("$size", ptr2ref(addr)),
lit(at->getNumElements()) )));
Since $size is not being set for any other type of objects anyways.

@michael-emmi
Copy link
Contributor

Well I have ruled out your root cause in commit 861dd6e by completely removing the $size predicate (which is practically useless), yet the following

smack-verify.py floppy_unsafe.i.cil.bc --mem-mod=twodim

still does not report the violation which is reported with --mem-mod=flat.

...so the investigation continues. :-)

@zvonimir
Copy link
Member Author

The problem mentioned in the previous comment was caused by unsound handling of ptr2int in the twodim memory model, which is being phased out. So I am closing this issue.

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

No branches or pull requests

2 participants