@@ -771,6 +771,7 @@ Function: abstract_environmentt::environment_diff
771771std::vector<symbol_exprt> abstract_environmentt::modified_symbols (
772772 const abstract_environmentt &first, const abstract_environmentt &second)
773773{
774+ // Find all symbols who have different write locations in each map
774775 std::vector<symbol_exprt> symbols_diff;
775776 for (const auto &entry : first.map )
776777 {
@@ -782,19 +783,10 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
782783 // in the other
783784 // Since a set can assume at most one match
784785
785- #if 0
786- const auto location_matcher=
787- [&](
788- goto_programt::const_targett instruction,
789- goto_programt::const_targett other_instruction)
790- {
791- return other_instruction->location_number<instruction->location_number;
792- };
793- #endif
794-
795-
796- const abstract_objectt::locationst &a=entry.second ->get_last_written_locations ();
797- const abstract_objectt::locationst &b=second_entry->second ->get_last_written_locations ();
786+ const abstract_objectt::locationst &first_write_locations=
787+ entry.second ->get_last_written_locations ();
788+ const abstract_objectt::locationst &second_write_locations=
789+ second_entry->second ->get_last_written_locations ();
798790
799791 class location_ordert
800792 {
@@ -803,21 +795,23 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
803795 goto_programt::const_targett instruction,
804796 goto_programt::const_targett other_instruction)
805797 {
806- return instruction->location_number >other_instruction->location_number ;
798+ return instruction->location_number >
799+ other_instruction->location_number ;
807800 }
808801 };
809802
810- typedef std::set<goto_programt::const_targett, location_ordert> sorted_locationst;
803+ typedef std::set<goto_programt::const_targett, location_ordert>
804+ sorted_locationst;
811805
812806 sorted_locationst lhs_location;
813- for (const auto &entry:a )
807+ for (const auto &entry:first_write_locations )
814808 {
815809 lhs_location.insert (entry);
816810 }
817811
818812
819813 sorted_locationst rhs_location;
820- for (const auto &entry:b )
814+ for (const auto &entry:second_write_locations )
821815 {
822816 rhs_location.insert (entry);
823817 }
@@ -830,23 +824,8 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
830824 rhs_location.cend (),
831825 std::inserter (intersection, intersection.end ()),
832826 location_ordert ());
833- bool all_matched=intersection.size ()==a.size () &&
834- intersection.size ()==b.size ();
835-
836- #if 0
837- std::cout << entry.first.get_identifier() << ": {";
838- for(const auto &entry:lhs_location)
839- {
840- std::cout << entry->location_number << ", ";
841- }
842-
843- std::cout << " } vs { ";
844- for(const auto &entry:rhs_location)
845- {
846- std::cout << entry->location_number << ", ";
847- }
848- std::cout << " }" << std::endl;
849- #endif
827+ bool all_matched=intersection.size ()==first_write_locations.size () &&
828+ intersection.size ()==second_write_locations.size ();
850829
851830 if (!all_matched)
852831 {
@@ -855,6 +834,7 @@ std::vector<symbol_exprt> abstract_environmentt::modified_symbols(
855834 }
856835 }
857836
837+ // Add any symbols that are only in the second map
858838 for (const auto &entry : second.map )
859839 {
860840 const auto &second_entry = first.map .find (entry.first );
0 commit comments