Skip to content

freeze lazy constraints, unused variable? #1581

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
polgreen opened this issue Nov 13, 2017 · 3 comments
Closed

freeze lazy constraints, unused variable? #1581

polgreen opened this issue Nov 13, 2017 · 3 comments

Comments

@polgreen
Copy link
Contributor

This is a question rather than a bug report, but I wasn't sure who to direct the question to.

I'm looking at the function bv_refinementt::freeze_lazy_constraints()
https://github.com/diffblue/cbmc/blob/develop/src/solvers/refinement/refine_arrays.cpp#L118-L139

I don't really understand what this loop is doing:

std::set<symbol_exprt> symbols;
find_symbols(l_it->lazy, symbols);
for(std::set<symbol_exprt>::const_iterator it=symbols.begin(); it!=symbols.end(); ++it)
{
  bvt bv=convert_bv(l_it->lazy);
  forall_literals(b_it, bv)
    if(!b_it->is_constant())
      prop.set_frozen(*b_it);
}

The iterator "it" for the outer loop is never used, and calling set_frozen multiple times is the same as calling it once, so I think the code would do the same thing if the loop was removed?

I tried removing the outer for loop completely and all the regression tests pass.

@romainbrenguier
Copy link
Contributor

Strange, there is something wrong here. I guess it was meant to be bvt bv=convert_bv(*it); on the 5th line, but I think @kroening should confirm that.

@kroening
Copy link
Member

Yes, *it seems the thing

@polgreen
Copy link
Contributor Author

Ok, I've made that change in my version now. Pull request might have been slightly pointless, but it's here: #1588

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

No branches or pull requests

4 participants