Skip to content

Error convert_bitwise: unexpected operand width #164

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
mgudemann opened this issue Jul 4, 2016 · 3 comments
Closed

Error convert_bitwise: unexpected operand width #164

mgudemann opened this issue Jul 4, 2016 · 3 comments

Comments

@mgudemann
Copy link
Contributor

The following fails with cbmc --cover location --function bitwise1.f bitwise1.class with the above error.

public class bitwise1
{
  static char c;
  void f()
  {
    int i = (c & 2);
  }
}

In boolbvt_bitwise::convert_bitwise the reported width of the char operand is 16 (from std::size_t width=boolbv_width(expr.type());) but the size of the converted operand is 32. Java uses widening numeric promotion to int in this case. Interestingly, this program does not produce the above error in the following version (1 instead of 2):

public class bitwise1
{
  static char c;
  void f()
  {
    int i = (c & 1);
  }
}
@kroening
Copy link
Member

Fixed with bb6b907.

@mgudemann
Copy link
Contributor Author

is this already pushed to the repo?

@kroening
Copy link
Member

Yes, github has it at
bb6b907

thk123 added a commit that referenced this issue Oct 17, 2017
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

3 participants