[petsc-users] Compiler Warning
    Barry Smith 
    bsmith at mcs.anl.gov
       
    Wed Nov  3 08:09:35 CDT 2010
    
    
  
On Nov 3, 2010, at 7:33 AM, Jed Brown wrote:
> On Wed, Nov 3, 2010 at 02:39, Andreas Hauffe <andreas.hauffe at tu-dresden.de> wrote:
> Hi,
> 
> during the compilation process I'm getting the following warning. Is this a
> problem?
> 
> Warning libfast in: /scratch/ahauffe/petsc-3.1-p5/src/vec/vec/utils
> vscat.c(322): warning #592: variable "sto" is used before its value is set
>    ierr                =
> PetscMalloc2(1,VecScatter_MPI_ToAll,&sto,size,PetscMPIInt,&sto-
> >count);CHKERRQ(ierr);
> 
> Thanks for pointing this out, I didn't notice when it was introduced (to fix a different warning).
> 
> http://petsc.cs.iit.edu/petsc/petsc-dev/rev/4ff7b4bc0bea
> 
> I'm surprised other compilers haven't warned about this, and that we haven't seen any bad behavior because of it.
> 
> We either need to find a way to tweak the macro to clean up after itself correctly in the case of malloc failure, without dereferencing something that may not exist yet (conflicting goals), or fix any calls that try to build a structure like this with a single malloc.
  Are you sure this is not a compiler bug. It seems to me the code is ok, what am I missing?
   Barry
> 
> Jed
    
    
More information about the petsc-users
mailing list