Skip to content

[SV-COMP'18 16/19] Bugfix[byte_extract]: handling negative offsets by unknown bits. #2005

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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions src/solvers/flattening/boolbv_byte_extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,13 @@ bvt boolbvt::convert_byte_extract(const byte_extract_exprt &expr)
mp_integer index;
if(!to_integer(offset, index))
{
if(index<0)
throw "byte_extract flatting with negative offset: "+expr.pretty();

mp_integer offset=index*byte_width;

std::size_t offset_i=integer2unsigned(offset);
long offset_i=offset.to_long();

for(std::size_t i=0; i<width; i++)
for(long i=0; i<(long)width; i++)
// out of bounds?
if(offset<0 || offset_i+i>=op_bv.size())
if(offset<0 || offset_i+i>=(long)op_bv.size())
bv[i]=prop.new_variable();
else
bv[i]=op_bv[offset_i+i];
Expand Down