On Wed, Jun 8, 2011 at 10:47 AM, Blaise Bourdin <span dir="ltr"><<a href="mailto:bourdin@lsu.edu">bourdin@lsu.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br>
<br>
After poking a bit, I found out the bug causing a segfault in the above-mentioned functions. It seems that gfortran will gladly nullify a bogus pointer, whereas ifort can be a bit pickier, hence the bug coming up only with intel compilers.<br>

Can you check that the following patch makes sense and if so apply it to petsc-dev?<br></blockquote><div><br></div><div>Crap, really. How did valgrind, and gmalloc miss that one? Ugh.</div><div><br></div><div>  Thanks,</div>
<div><br></div><div>     Matt</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Thanks,<br>
<br>
Blaise<br>
<br>
--- a/src/dm/impls/mesh/f90-custom/zmeshf90.c   Tue Jun 07 23:08:25 2011 -0500<br>
+++ b/src/dm/impls/mesh/f90-custom/zmeshf90.c   Wed Jun 08 09:54:14 2011 -0500<br>
@@ -31,7 +31,7 @@ void PETSC_STDCALL dmmeshrestorecoordina<br>
{<br>
  PetscReal *c;<br>
  *__ierr = F90Array2dAccess(ptr,PETSC_REAL,(void**)&c PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
-  *__ierr = F90Array2dDestroy(&ptr,PETSC_REAL PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
+  *__ierr = F90Array2dDestroy(ptr,PETSC_REAL PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
  *__ierr = PetscFree(c);<br>
}<br>
void PETSC_STDCALL dmmeshgetelementsf90_(DM *dm,F90Array2d *ptr,int *__ierr PETSC_F90_2PTR_PROTO(ptrd))<br>
@@ -45,7 +45,7 @@ void PETSC_STDCALL dmmeshrestoreelements<br>
{<br>
  PetscInt   *v;<br>
  *__ierr = F90Array2dAccess(ptr,PETSC_INT,(void**)&v PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
-  *__ierr = F90Array2dDestroy(&ptr,PETSC_INT PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
+  *__ierr = F90Array2dDestroy(ptr,PETSC_INT PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
  *__ierr = PetscFree(v);<br>
}<br>
void PETSC_STDCALL dmmeshgetconef90_(DM *dm,PetscInt *p,F90Array1d *ptr,int *__ierr PETSC_F90_2PTR_PROTO(ptrd))<br>
@@ -56,7 +56,7 @@ void PETSC_STDCALL dmmeshgetconef90_(DM<br>
}<br>
void PETSC_STDCALL dmmeshrestoreconef90_(DM *dm,F90Array1d *ptr,int *__ierr PETSC_F90_2PTR_PROTO(ptrd))<br>
{<br>
-  *__ierr = F90Array2dDestroy(&ptr,PETSC_INT PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
+  *__ierr = F90Array2dDestroy(ptr,PETSC_INT PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
}<br>
<br>
#if 0<br>
@@ -64,7 +64,7 @@ void PETSC_STDCALL dmmeshrestoreclosuref<br>
{<br>
  PetscReal *c;<br>
  *__ierr = F90Array1dAccess(ptr,PETSC_REAL,(void**)&c PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
-  *__ierr = F90Array1dDestroy(&ptr,PETSC_REAL PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
+  *__ierr = F90Array1dDestroy(ptr,PETSC_REAL PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;<br>
  *__ierr = PetscFree(c);<br>
}<br>
#endif<br>
<font color="#888888">--<br>
Department of Mathematics and Center for Computation & Technology<br>
Louisiana State University, Baton Rouge, LA 70803, USA<br>
Tel. <a href="tel:%2B1%20%28225%29%20578%201612" value="+12255781612">+1 (225) 578 1612</a>, Fax  <a href="tel:%2B1%20%28225%29%20578%204276" value="+12255784276">+1 (225) 578 4276</a> <a href="http://www.math.lsu.edu/~bourdin" target="_blank">http://www.math.lsu.edu/~bourdin</a><br>

<br>
<br>
<br>
<br>
<br>
<br>
<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead.<br>-- Norbert Wiener<br>