-Wshadow can be used with GCC or clang to produce these exact warnings.<div><br></div><div>I prefer to setup test builds with the following compiler flags to find as many possible errors: -Wall -Wextra -Wcast-align -Wpointer-arith -Wformat -Wformat-security -Wshadow -Wunused-parameter</div>
<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Dec 4, 2012 at 7:42 PM, Vijay S. Mahadevan <span dir="ltr"><<a href="mailto:vijay.m@gmail.com" target="_blank">vijay.m@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I pulled the latest moab source and compiled with Intel on a linux machine.<br>
<br>
I get the following warning which could be serious:<br>
<br>
ParallelComm.cpp(4091): remark #1599: declaration hides variable "k"<br>
(declared at line 4068)<br>
<br>
variable k is defined at both 4068 and 4091. I would've modified the<br>
inner loop to use a different variable but am not sure how to modify<br>
the source inside correspondingly. Can someone please fix this since<br>
it could cause some serious bugs because the variable 'k' is ambiguous<br>
in lines 4094:4098. Using some descriptive variable names for indexes<br>
would also be helpful rather than i, j, k etc..<br>
<br>
4068 for (int k=0; k<nbPairsMultiShared; k++)<br>
4069 {<br>
4070 int startMulti=multiSharedStartEnd[2*k];<br>
4071 int endMulti =multiSharedStartEnd[2*k+1];<br>
4072 // so tuples indices start, end, will be remote sent for multi sharing<br>
4073 // first tuple sent will be with the owner infos, the other<br>
4074 for (int j=startMulti; j<=endMulti; j++)<br>
4075 {<br>
4076 // first send to processor the info about the local handle<br>
(which will be the owner)<br>
4077 int proc_to_send_to = remoting_entities.vi_wr[j];<br>
4078 EntityHandle handle_on_owning_proc =<br>
remoting_entities.vul_wr[2*j+1]; // it was remote before<br>
...................<br>
...................<br>
4089 multishared_verts.inc_n();<br>
4090 // create more tuples, for each instance<br>
4091 for (int k=startMulti; k<=endMulti; k++)<br>
4092 {<br>
4093 multishared_verts.vi_wr[2*indexInTuple] =<br>
proc_to_send_to; // send to<br>
4094 multishared_verts.vi_wr[2*indexInTuple+1] =<br>
remoting_entities.vi_wr[k]; // multi proc<br>
4095 multishared_verts.vl_wr[indexInTuple] =<br>
remoting_entities.vl_wr[k]; // gid, for debug<br>
4096 multishared_verts.vul_wr[2*indexInTuple] =<br>
handle_with_multi; // remote handle on proc_to_send_to<br>
4097 multishared_verts.vul_wr[2*indexInTuple+1] =<br>
remoting_entities.vul_wr[2*k]; // handle on multi proc<br>
4098 indexInTuple++;<br>
4099 multishared_verts.inc_n();<br>
4100 }<br>
4101 }<br>
4102 }<br>
<span class="HOEnZb"><font color="#888888"><br>
Vijay<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br>Robert Maynard<br>
</div>