Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix the communication optimization.
[simgrid.git] / src / smpi / smpi_shared.cpp
index 0aacb65..e629da9 100644 (file)
@@ -353,7 +353,8 @@ int smpi_is_shared(void* ptr, std::vector<std::pair<int, int>> &private_blocks,
       return 0;
     low --;
     if (ptr < (char*)low->first + low->second.size) {
-      *offset = ((uint8_t*) low->first) - ((uint8_t*)ptr);
+      xbt_assert(ptr > (char*)low->first, "Oops, there seems to be a bug in the shared memory metadata.");
+      *offset = ((uint8_t*)ptr) - ((uint8_t*) low->first);
       private_blocks = low->second.private_blocks;
       return 1;
     }