[petsc-users] [petsc-dev] Compiler Warning

Barry Smith bsmith at mcs.anl.gov
Wed Nov 3 12:50:46 CDT 2010


On Nov 3, 2010, at 11:39 AM, Jed Brown wrote:

> [moving to petsc-dev]
> 
> On Wed, Nov 3, 2010 at 10:54, Barry Smith <bsmith at mcs.anl.gov> wrote:
> Right, this is very bad. We set the r2 and r3 up front so the compiler won't complain about possible not set values?
> 
> I don't know, you wrote that code.  I stripped it out of a local build and I don't get any warnings in optimized mode (with gcc or clang).  I think those warnings were a compiler bug, unless you only saw them with-errorchecking=0.

  Because of the || *r2 may never get set, but it gets used later in the routine. Maybe compilers shouldn't give the warning but some did.

   Barry

> 
>  I guess we need to not use PetscMallocN() for structs and values in the structs.
> 
> Maybe, but only if we really need to set r2 up front.
> 
> Jed



More information about the petsc-users mailing list