<div dir="ltr">Stefano,<div style>The bug is fixed and merged to the next branch for regression tests</div><div style><a href="https://bitbucket.org/petsc/petsc/commits/9972d2cea69f576862c8d7ac556aa3a0a50ab130">https://bitbucket.org/petsc/petsc/commits/9972d2cea69f576862c8d7ac556aa3a0a50ab130</a><br>
</div><div style>Once it passes all the tests tomorrow, I'll merge it to master.</div><div style><br></div><div style>Thanks for your contribution!</div><div style><br></div><div style>Hong</div></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Wed, Oct 2, 2013 at 10:40 AM, Stefano Zampini <span dir="ltr"><<a href="mailto:s.zampini@cineca.it" target="_blank">s.zampini@cineca.it</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Is it the right solution?<br><div><br>diff --git a/src/sys/objects/subcomm.c b/src/sys/objects/subcomm.c<br>index 752550d..17ef49b 100644<br>--- a/src/sys/objects/subcomm.c<br>+++ b/src/sys/objects/subcomm.c<br>

@@ -186,7 +186,7 @@ PetscErrorCode PetscSubcommSetTypeGeneral(PetscSubcomm psubcomm,PetscMPIInt colo<br>   ierr = MPI_Allgather(sendbuf,2,MPI_INT,recvbuf,2,MPI_INT,comm);CHKERRQ(ierr);<br> <br>   ierr = PetscMalloc(nsubcomm*sizeof(PetscMPIInt),&subsize);CHKERRQ(ierr);<br>

-  for (i=0; i<2*size; i++) {<br>+  for (i=0; i<2*size; i+=2) {<div class="im"><br>     subsize[recvbuf[i]] = recvbuf[i+1];<br>   }<br></div>   ierr = PetscFree(recvbuf);CHKERRQ(ierr);<br><br></div></div><div class="HOEnZb">
<div class="h5"><div class="gmail_extra"><br><br>
<div class="gmail_quote">2013/10/2 Stefano Zampini <span dir="ltr"><<a href="mailto:s.zampini@cineca.it" target="_blank">s.zampini@cineca.it</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div dir="ltr"><div><div>Hong,<br><br></div>currently in master there's an error in PetscSubcommSetTypeGeneral, namely in the loop starting at line 188<br><br><pre><span>for</span> <span>(</span><span>i</span><span>=</span><span>0</span><span>;</span> <span>i</span><span><</span><span>2</span><span>*</span><span>size</span><span>;</span> <span>i</span><span>++</span><span>)</span> <span>{</span>
<a name="14179d40e0242219_14179d01a4ed1f94_cl-189"></a>    <span>subsize</span><span>[</span><span>recvbuf</span><span>[</span><span>i</span><span>]]</span> <span>=</span> <span>recvbuf</span><span>[</span><span>i</span><span>+</span><span>1</span><span>];</span>
<a name="14179d40e0242219_14179d01a4ed1f94_cl-190"></a><span>}</span></pre>recvbuf is allocated at line 178 as 2*size*sizeof(PetscMPIInt), and the loop tries to read at location 2*size<br><br></div>Could you please fix it?<span><font color="#888888"><br>

<br><br clear="all">
<div><div><div><div><br>-- <br><div dir="ltr"><pre cols="72"><font><span style="font-family:garamond,serif"><span style="font-family:garamond,serif"></span>Ph. D. Stefano Zampini<br>CINECA  
SuperComputing Applications and Innovations Department - SCAI
Via dei Tizii, 6 00185 Roma - ITALY
------------------------------------------------------------------------------------------------------------------------
Email: <a href="mailto:s.zampini@cineca.it" target="_blank"><span>s.zampini@cineca.it</span></a>
SkypeID: stefano.zampini
GoogleTalk: <a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>
Tel: <a value="+390644486720">+39 06.44486.707<br></a></span></font><a value="+390644486720"><font><span style="font-family:garamond,serif">------------------------------------------------------------------------------------------------------------------------
</span></font><br></a></pre></div>
</div></div></div></div></font></span></div>
</blockquote></div><br><br clear="all"><br>-- <br><div dir="ltr"><pre cols="72"><font><span style="font-family:garamond,serif"><span style="font-family:garamond,serif"></span>Ph. D. Stefano Zampini<br>CINECA  
SuperComputing Applications and Innovations Department - SCAI
Via dei Tizii, 6 00185 Roma - ITALY
------------------------------------------------------------------------------------------------------------------------
Email: <a href="mailto:s.zampini@cineca.it" target="_blank"><span>s.zampini@cineca.it</span></a>
SkypeID: stefano.zampini
GoogleTalk: <a href="mailto:stefano.zampini@gmail.com" target="_blank">stefano.zampini@gmail.com</a>
Tel: <a value="+390644486720">+39 06.44486.707<br></a></span></font><a value="+390644486720"><font><span style="font-family:garamond,serif">------------------------------------------------------------------------------------------------------------------------
</span></font><br></a></pre></div>
</div>
</div></div></blockquote></div><br></div>