File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
src/solvers/smt2_incremental Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -598,6 +598,40 @@ static smt_termt convert_expr_to_smt(
598598 return convert_multiary_operator_to_terms (
599599 plus, converted, smt_bit_vector_theoryt::add);
600600 }
601+ else if (std::any_of (
602+ plus.operands ().cbegin (),
603+ plus.operands ().cend (),
604+ [](exprt operand)
605+ { return can_cast_type<pointer_typet>(operand.type ()); }))
606+ {
607+ INVARIANT (
608+ plus.operands ().size () == 2 ,
609+ " We are only handling a binary version of plus when it has a pointer "
610+ " operand" );
611+
612+ exprt pointer;
613+ exprt scalar;
614+ for (auto &operand : plus.operands ())
615+ {
616+ if (can_cast_type<pointer_typet>(operand.type ()))
617+ {
618+ pointer = operand;
619+ }
620+ else
621+ {
622+ scalar = operand;
623+ }
624+ }
625+
626+ pointer_typet pointer_type =
627+ *type_try_dynamic_cast<pointer_typet>(pointer.type ());
628+ auto base_type = pointer_type.base_type ();
629+ auto pointer_size = pointer_sizes.at (base_type);
630+
631+ return smt_bit_vector_theoryt::add (
632+ converted.at (pointer),
633+ smt_bit_vector_theoryt::multiply (converted.at (scalar), pointer_size));
634+ }
601635 else
602636 {
603637 UNIMPLEMENTED_FEATURE (
You can’t perform that action at this time.
0 commit comments