From: Gabriel Corona Date: Thu, 11 Feb 2016 12:21:11 +0000 (+0100) Subject: Revert "[mc] Fix loop bound checking using heaplimit" X-Git-Tag: v3_13~872^2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/764d7971b97ce839afe7527559f33d68d3262d88 Revert "[mc] Fix loop bound checking using heaplimit" This reverts commit 15d7df6ae57645a0b6f3c0fb07eff36a14da555b. The fix seems commit but currently breaks test test. I'll bring it back while the MC is stable. --- diff --git a/src/mc/mc_diff.cpp b/src/mc/mc_diff.cpp index 89b5b544eb..f8bbd845b1 100644 --- a/src/mc/mc_diff.cpp +++ b/src/mc/mc_diff.cpp @@ -337,7 +337,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) const malloc_info* heapinfos2 = snapshot2->read( (std::uint64_t)heapinfo_address, simgrid::mc::ProcessIndexMissing); - while (i1 < state->heaplimit) { + while (i1 <= state->heaplimit) { const malloc_info* heapinfo1 = (const malloc_info*) MC_region_read(heap_region1, &heapinfo_temp1, &heapinfos1[i1], sizeof(malloc_info)); const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read(heap_region2, &heapinfo_temp2, &heapinfos2[i1], sizeof(malloc_info)); @@ -401,7 +401,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) } - while (i2 < state->heaplimit && !equal) { + while (i2 <= state->heaplimit && !equal) { addr_block2 = (ADDR2UINT(i2) - 1) * BLOCKSIZE + (char *) state->std_heap_copy.heapbase; @@ -486,7 +486,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) } - while (i2 < state->heaplimit && !equal) { + while (i2 <= state->heaplimit && !equal) { const malloc_info* heapinfo2b = (const malloc_info*) MC_region_read( heap_region2, &heapinfo_temp2b, &heapinfos2[i2], @@ -560,7 +560,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) /* All blocks/fragments are equal to another block/fragment ? */ size_t i = 1, j = 0; - for(i = 1; i < state->heaplimit; i++) { + for(i = 1; i <= state->heaplimit; i++) { const malloc_info* heapinfo1 = (const malloc_info*) MC_region_read( heap_region1, &heapinfo_temp1, &heapinfos1[i], sizeof(malloc_info)); if (heapinfo1->type == MMALLOC_TYPE_UNFRAGMENTED) { @@ -602,7 +602,7 @@ int mmalloc_compare_heap(mc_snapshot_t snapshot1, mc_snapshot_t snapshot2) if (i1 == state->heaplimit) XBT_DEBUG("Number of blocks/fragments not found in heap1 : %d", nb_diff1); - for (i=1; i < state->heaplimit; i++) { + for (i=1; i <= state->heaplimit; i++) { const malloc_info* heapinfo2 = (const malloc_info*) MC_region_read( heap_region2, &heapinfo_temp2, &heapinfos2[i], sizeof(malloc_info)); if (heapinfo2->type == MMALLOC_TYPE_UNFRAGMENTED) { diff --git a/src/xbt/mmalloc/mm_module.c b/src/xbt/mmalloc/mm_module.c index 8b9ebaa6c5..344023658c 100644 --- a/src/xbt/mmalloc/mm_module.c +++ b/src/xbt/mmalloc/mm_module.c @@ -359,7 +359,7 @@ void mmalloc_postexit(void) size_t mmalloc_get_bytes_used_remote(size_t heaplimit, const malloc_info* heapinfo) { int bytes = 0; - for (size_t i=0; i < heaplimit; ++i){ + for (size_t i=0; i<=heaplimit; ++i){ if (heapinfo[i].type == MMALLOC_TYPE_UNFRAGMENTED){ if (heapinfo[i].busy_block.busy_size > 0) bytes += heapinfo[i].busy_block.busy_size;