[MOAB-dev] r4406 - MOAB/trunk/src/parallel

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Dec 22 12:51:57 CST 2010


Author: kraftche
Date: 2010-12-22 12:51:57 -0600 (Wed, 22 Dec 2010)
New Revision: 4406

Modified:
   MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
Log:
fix use of uninitialized value (step off end of array) in parallel HDF5 writer

Modified: MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
===================================================================
--- MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp	2010-12-22 18:09:59 UTC (rev 4405)
+++ MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp	2010-12-22 18:51:57 UTC (rev 4406)
@@ -1070,7 +1070,7 @@
     for (int i = 0; i < numtypes; i++) 
     {
       long prev = 0;
-      for (unsigned int j = 0; j <= myPcomm->proc_config().proc_size(); j++)
+      for (unsigned int j = 0; j < myPcomm->proc_config().proc_size(); j++)
       {
         long tmp = counts[j*numtypes + i];
         if (tmp > my_counts[i]) // put max count in my_counts
@@ -1078,6 +1078,7 @@
         counts[j*numtypes+i] = prev;
         prev += tmp;
       }
+      counts[myPcomm->proc_config().proc_size()*numtypes + i] = prev;
     }
   }
   
@@ -1187,7 +1188,7 @@
     for (i = 0; i < numtypes; i++) 
     {
       long prev = 0;
-      for (j = 0; j <= myPcomm->proc_config().proc_size(); j++)
+      for (j = 0; j < myPcomm->proc_config().proc_size(); j++)
       {
         long tmp = all[j*numtypes + i];
         if (tmp > local[i])
@@ -1195,6 +1196,7 @@
         all[j*numtypes+i] = prev;
         prev += tmp;
       }
+      all[myPcomm->proc_config().proc_size()+numtypes+i] = prev;
     }
 
       // For each element type for which there is no adjacency data,















More information about the moab-dev mailing list