Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Use mc_region_contain where it could be used
[simgrid.git] / src / mc / mc_compare.cpp
index cbaedb5..0ab694a 100644 (file)
@@ -186,12 +186,10 @@ static int compare_areas_with_type(struct mc_compare_state& state,
         return compare_heap_area(addr_pointed1, addr_pointed2, snapshot1,
                                  snapshot2, NULL, type->subtype, pointer_level);
       }
+
       // The pointers are both in the current object R/W segment:
-      else if (addr_pointed1 > region1->start_addr
-               && (char *) addr_pointed1 <= (char *) region1->start_addr + region1->size) {
-        if (!
-            (addr_pointed2 > region2->start_addr
-             && (char *) addr_pointed2 <= (char *) region2->start_addr + region2->size))
+      else if (mc_region_contain(region1, addr_pointed1)) {
+        if (!mc_region_contain(region2, addr_pointed2))
           return 1;
         if (type->dw_type_id == NULL)
           return (addr_pointed1 != addr_pointed2);
@@ -203,6 +201,9 @@ static int compare_areas_with_type(struct mc_compare_state& state,
         }
       }
 
+      // TODO, We do not handle very well the case where
+      // it belongs to a different (non-heap) region from the current one.
+
       else {
         return (addr_pointed1 != addr_pointed2);
       }