[petsc-dev] Fix for long-standing bug in DMMeshRestoreCoordinatesF90 and DMMeshRestoreElementsF90
Matthew Knepley
knepley at gmail.com
Wed Jun 8 13:23:09 CDT 2011
On Wed, Jun 8, 2011 at 10:47 AM, Blaise Bourdin <bourdin at lsu.edu> wrote:
> Hi,
>
> 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.
> Can you check that the following patch makes sense and if so apply it to
> petsc-dev?
>
Crap, really. How did valgrind, and gmalloc miss that one? Ugh.
Thanks,
Matt
> Thanks,
>
> Blaise
>
> --- a/src/dm/impls/mesh/f90-custom/zmeshf90.c Tue Jun 07 23:08:25 2011
> -0500
> +++ b/src/dm/impls/mesh/f90-custom/zmeshf90.c Wed Jun 08 09:54:14 2011
> -0500
> @@ -31,7 +31,7 @@ void PETSC_STDCALL dmmeshrestorecoordina
> {
> PetscReal *c;
> *__ierr = F90Array2dAccess(ptr,PETSC_REAL,(void**)&c
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> - *__ierr = F90Array2dDestroy(&ptr,PETSC_REAL
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> + *__ierr = F90Array2dDestroy(ptr,PETSC_REAL
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> *__ierr = PetscFree(c);
> }
> void PETSC_STDCALL dmmeshgetelementsf90_(DM *dm,F90Array2d *ptr,int *__ierr
> PETSC_F90_2PTR_PROTO(ptrd))
> @@ -45,7 +45,7 @@ void PETSC_STDCALL dmmeshrestoreelements
> {
> PetscInt *v;
> *__ierr = F90Array2dAccess(ptr,PETSC_INT,(void**)&v
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> - *__ierr = F90Array2dDestroy(&ptr,PETSC_INT
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> + *__ierr = F90Array2dDestroy(ptr,PETSC_INT PETSC_F90_2PTR_PARAM(ptrd));if
> (*__ierr) return;
> *__ierr = PetscFree(v);
> }
> void PETSC_STDCALL dmmeshgetconef90_(DM *dm,PetscInt *p,F90Array1d *ptr,int
> *__ierr PETSC_F90_2PTR_PROTO(ptrd))
> @@ -56,7 +56,7 @@ void PETSC_STDCALL dmmeshgetconef90_(DM
> }
> void PETSC_STDCALL dmmeshrestoreconef90_(DM *dm,F90Array1d *ptr,int *__ierr
> PETSC_F90_2PTR_PROTO(ptrd))
> {
> - *__ierr = F90Array2dDestroy(&ptr,PETSC_INT
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> + *__ierr = F90Array2dDestroy(ptr,PETSC_INT PETSC_F90_2PTR_PARAM(ptrd));if
> (*__ierr) return;
> }
>
> #if 0
> @@ -64,7 +64,7 @@ void PETSC_STDCALL dmmeshrestoreclosuref
> {
> PetscReal *c;
> *__ierr = F90Array1dAccess(ptr,PETSC_REAL,(void**)&c
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> - *__ierr = F90Array1dDestroy(&ptr,PETSC_REAL
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> + *__ierr = F90Array1dDestroy(ptr,PETSC_REAL
> PETSC_F90_2PTR_PARAM(ptrd));if (*__ierr) return;
> *__ierr = PetscFree(c);
> }
> #endif
> --
> Department of Mathematics and Center for Computation & Technology
> Louisiana State University, Baton Rouge, LA 70803, USA
> Tel. +1 (225) 578 1612, Fax +1 (225) 578 4276
> http://www.math.lsu.edu/~bourdin
>
>
>
>
>
>
>
>
--
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20110608/a24af204/attachment.html>
More information about the petsc-dev
mailing list