X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/e080adacaf1ba847ad467f5b8d21da385636ed3c..12623e213e87741da4f0e42917f31b51cf9db0f1:/src/smpi/internals/smpi_memory.cpp diff --git a/src/smpi/internals/smpi_memory.cpp b/src/smpi/internals/smpi_memory.cpp index 794d88e4f7..723c5df5e3 100644 --- a/src/smpi/internals/smpi_memory.cpp +++ b/src/smpi/internals/smpi_memory.cpp @@ -72,14 +72,14 @@ static void smpi_get_executable_global_size() /* Here we are making the assumption that a suitable empty region following the rw- area is the end of the data segment. It would be better to check with the size of the data segment. */ - ++i; - if (i != map.end() && i->pathname.empty() && (i->prot & PROT_RWX) == PROT_RW && - (char*)i->start_addr == smpi_data_exe_start + smpi_data_exe_size) { + auto j = i + 1; + if (j != map.end() && j->pathname.empty() && (j->prot & PROT_RWX) == PROT_RW && + (char*)j->start_addr == smpi_data_exe_start + smpi_data_exe_size) { // Only count the portion of this region not present in the initial map. - auto found = std::find_if(initial_vm_map.begin(), initial_vm_map.end(), [&i](const simgrid::xbt::VmMap& m) { - return i->start_addr <= m.start_addr && m.start_addr < i->end_addr; + auto found = std::find_if(initial_vm_map.begin(), initial_vm_map.end(), [&j](const simgrid::xbt::VmMap& m) { + return j->start_addr <= m.start_addr && m.start_addr < j->end_addr; }); - auto end_addr = (found == initial_vm_map.end() ? i->end_addr : found->start_addr); + auto end_addr = (found == initial_vm_map.end() ? j->end_addr : found->start_addr); smpi_data_exe_size = (char*)end_addr - smpi_data_exe_start; } return;