[petsc-users] Petsc with Address Sanitizer

Satish Balay balay at mcs.anl.gov
Tue Mar 15 10:39:31 CDT 2022


Likely configure will fail when all these options are used. Alternative:

- run 'configure' normally
- run 'make CFLAGS="-fsanitize=address -fsanitize=undefined..."

And its best to do this with petsc/main branch. And if you are able to find issues and fix them - you can submit merge requests with fixes at https://gitlab.com/petsc/petsc/-/merge_requests

Satish

On Tue, 15 Mar 2022, Jacob Faibussowitsch wrote:

> $ ./configure --COPTFLAGS=“-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment” --CXXOPTFLAGS=“-fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment"
> 
> Should do what you want. Note that as of the latest release PETSc is not exactly -fsanitize=undefined clean. We have integrated -fsanitize=address into CI but have yet to do the same for the other checkers.
> 
> Best regards,
> 
> Jacob Faibussowitsch
> (Jacob Fai - booss - oh - vitch)
> 
> > On Mar 15, 2022, at 11:09, Isaías Gallana <gallanaisaias at gmail.com> wrote:
> > 
> > Hi everyone.
> > 
> > I would like to compile petsc with a few of the Google Sanitizers, in particular ASAN.
> > I am using petsc-3.16.4, but I guess that is not relevant.
> > 
> > I have used for other projects
> > 
> > -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow -fno-sanitize=null -fno-sanitize=alignment
> > 
> > as shown in https://developers.redhat.com/blog/2021/05/05/memory-error-checking-in-c-and-c-comparing-sanitizers-and-valgrind#tldr. <https://developers.redhat.com/blog/2021/05/05/memory-error-checking-in-c-and-c-comparing-sanitizers-and-valgrind#tldr.>
> > 
> > I could not find the proper way to do that, and I do not even know if that is possible.
> > 
> > Does anyone know about this?
> > What is the proper configure line?
> > 
> > Thanks a lot
> > 
> > 
> > 
> > 
> > -- 
> > Isaías
> 
> 


More information about the petsc-users mailing list