[petsc-dev] Extra compiler flags for debugging

Satish Balay balay at mcs.anl.gov
Mon Mar 23 11:16:33 CDT 2020


On Mon, 23 Mar 2020, Jacob Faibussowitsch wrote:

> Hello all,
> 
> I’m wondering if you guys use any extra compiler flags when debugging (other than -g3). I have noticed for example that when compiling I am only warned about something (i.e. wrong argument type for a function) once, so if I recompile the same program with no changes, the second compilation doesn’t reproduce the warning.

Because the code doesn't get  recompiled when there are no changes.

You can use -Werror -  this will force to fix all warnings. [This is what we do in the test pipelines for some of the jobs]

Satish

> Currently I use the default compiler flags that petsc generates for debugging support with MPICH: 
> 
> C Compiler:         /Users/jacobfaibussowitsch/NoSync/petscpackages/bin/mpicc  -Wall -Wwrite-strings -Wno-strict-aliasing -Wno-unknown-pragmas -fstack-protector -fno-stack-check -Qunused-arguments -fvisibility=hidden -g3 
> 
> Version: Apple clang version 11.0.0 (clang-1100.0.33.17)
> 
> I’m mainly trying to find a 64-bit bug, so I have now added the “-ftrapv” flag to trap for integer overflows but there are probably more flags out there.
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> Cell: (312) 694-3391
> 
> 


More information about the petsc-dev mailing list