Skip to content

Commit e2b4997

Browse files
committed
SMT2 backend: fix parsing of +oo, -oo, NaN
This fixes an off-by-one bug in the SMT2 backend when parsing +oo, -oo and NaN expressions.
1 parent 1aaaefb commit e2b4997

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/solvers/smt2/smt2_conv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,23 +406,23 @@ constant_exprt smt2_convt::parse_literal(
406406
{
407407
std::size_t e = unsafe_string2size_t(src.get_sub()[2].id_string());
408408
std::size_t s = unsafe_string2size_t(src.get_sub()[3].id_string());
409-
return ieee_floatt::plus_infinity(ieee_float_spect(s, e)).to_expr();
409+
return ieee_floatt::plus_infinity(ieee_float_spect(s - 1, e)).to_expr();
410410
}
411411
else if(src.get_sub().size()==4 &&
412412
src.get_sub()[0].id()=="_" &&
413413
src.get_sub()[1].id()=="-oo") // (_ -oo e s)
414414
{
415415
std::size_t e = unsafe_string2size_t(src.get_sub()[2].id_string());
416416
std::size_t s = unsafe_string2size_t(src.get_sub()[3].id_string());
417-
return ieee_floatt::minus_infinity(ieee_float_spect(s, e)).to_expr();
417+
return ieee_floatt::minus_infinity(ieee_float_spect(s - 1, e)).to_expr();
418418
}
419419
else if(src.get_sub().size()==4 &&
420420
src.get_sub()[0].id()=="_" &&
421421
src.get_sub()[1].id()=="NaN") // (_ NaN e s)
422422
{
423423
std::size_t e = unsafe_string2size_t(src.get_sub()[2].id_string());
424424
std::size_t s = unsafe_string2size_t(src.get_sub()[3].id_string());
425-
return ieee_floatt::NaN(ieee_float_spect(s, e)).to_expr();
425+
return ieee_floatt::NaN(ieee_float_spect(s - 1, e)).to_expr();
426426
}
427427

428428
if(type.id()==ID_signedbv ||

0 commit comments

Comments
 (0)