@@ -621,6 +621,17 @@ void rw_range_sett::get_objects_rec(const typet &type)
621621 }
622622}
623623
624+ void rw_range_sett::get_array_objects (
625+ const irep_idt &,
626+ goto_programt::const_targett,
627+ get_modet mode,
628+ const exprt &pointer)
629+ {
630+ object_descriptor_exprt ode;
631+ ode.build (dereference_exprt{skip_typecast (pointer)}, ns);
632+ get_objects_rec (mode, ode.root_object (), -1 , -1 );
633+ }
634+
624635void rw_range_set_value_sett::get_objects_dereference (
625636 get_modet mode,
626637 const dereference_exprt &deref,
@@ -737,6 +748,50 @@ static void goto_rw_assign(
737748 rw_set.get_objects_rec (function, target, rw_range_sett::get_modet::READ, rhs);
738749}
739750
751+ static void goto_rw_other (
752+ const irep_idt &function,
753+ goto_programt::const_targett target,
754+ const codet &code,
755+ rw_range_sett &rw_set)
756+ {
757+ const irep_idt &statement = code.get_statement ();
758+
759+ if (statement == ID_printf)
760+ {
761+ // if it's printf, mark the operands as read here
762+ for (const auto &op : code.operands ())
763+ {
764+ rw_set.get_objects_rec (
765+ function, target, rw_range_sett::get_modet::READ, op);
766+ }
767+ }
768+ else if (statement == ID_array_equal)
769+ {
770+ // mark the dereferenced operands as being read
771+ for (const auto &op : code.operands ())
772+ {
773+ rw_set.get_array_objects (
774+ function, target, rw_range_sett::get_modet::READ, op);
775+ }
776+ }
777+ else if (statement == ID_array_set)
778+ {
779+ PRECONDITION (code.operands ().size () == 2 );
780+ rw_set.get_array_objects (
781+ function, target, rw_range_sett::get_modet::LHS_W, code.op0 ());
782+ rw_set.get_objects_rec (
783+ function, target, rw_range_sett::get_modet::READ, code.op1 ());
784+ }
785+ else if (statement == ID_array_copy || statement == ID_array_replace)
786+ {
787+ PRECONDITION (code.operands ().size () == 2 );
788+ rw_set.get_array_objects (
789+ function, target, rw_range_sett::get_modet::LHS_W, code.op0 ());
790+ rw_set.get_array_objects (
791+ function, target, rw_range_sett::get_modet::READ, code.op1 ());
792+ }
793+ }
794+
740795static void goto_rw (
741796 const irep_idt &function,
742797 goto_programt::const_targett target,
@@ -787,13 +842,7 @@ void goto_rw(
787842 break ;
788843
789844 case OTHER:
790- // if it's printf, mark the operands as read here
791- if (target->get_other ().get_statement () == ID_printf)
792- {
793- for (const auto &op : target->get_other ().operands ())
794- rw_set.get_objects_rec (
795- function, target, rw_range_sett::get_modet::READ, op);
796- }
845+ goto_rw_other (function, target, target->get_other (), rw_set);
797846 break ;
798847
799848 case SKIP:
0 commit comments