[MOAB-dev] ParallelComm.cpp - potential bug

Vijay S. Mahadevan vijay.m at gmail.com
Tue Dec 4 18:42:40 CST 2012


I pulled the latest moab source and compiled with Intel on a linux machine.

I get the following warning which could be serious:

ParallelComm.cpp(4091): remark #1599: declaration hides variable "k"
(declared at line 4068)

variable k is defined at both 4068 and 4091. I would've modified the
inner loop to use a different variable but am not sure how to modify
the source inside correspondingly. Can someone please fix this since
it could cause some serious bugs because the variable 'k' is ambiguous
in lines 4094:4098. Using some descriptive variable names for indexes
would also be helpful rather than i, j, k etc..

4068   for (int k=0; k<nbPairsMultiShared; k++)
4069   {
4070     int startMulti=multiSharedStartEnd[2*k];
4071     int endMulti  =multiSharedStartEnd[2*k+1];
4072     // so tuples indices start, end, will be remote sent for multi sharing
4073     // first tuple sent will be with the owner infos, the other
4074     for (int j=startMulti; j<=endMulti; j++)
4075     {
4076       // first send to processor the info about the local handle
(which will be the owner)
4077       int proc_to_send_to = remoting_entities.vi_wr[j];
4078       EntityHandle handle_on_owning_proc =
remoting_entities.vul_wr[2*j+1]; // it was remote before
...................
...................
4089       multishared_verts.inc_n();
4090       // create more tuples, for each instance
4091       for (int k=startMulti; k<=endMulti; k++)
4092       {
4093         multishared_verts.vi_wr[2*indexInTuple] =
proc_to_send_to; // send to
4094         multishared_verts.vi_wr[2*indexInTuple+1] =
remoting_entities.vi_wr[k]; // multi proc
4095         multishared_verts.vl_wr[indexInTuple] =
remoting_entities.vl_wr[k]; // gid, for debug
4096         multishared_verts.vul_wr[2*indexInTuple] =
handle_with_multi; // remote handle on proc_to_send_to
4097         multishared_verts.vul_wr[2*indexInTuple+1] =
remoting_entities.vul_wr[2*k]; // handle on multi proc
4098         indexInTuple++;
4099         multishared_verts.inc_n();
4100       }
4101     }
4102   }

Vijay


More information about the moab-dev mailing list