[petsc-users] Verifying matching PetscFunctionBeginUser() and PetscFunctionReturn()

Aagaard, Brad T baagaard at usgs.gov
Tue Jul 11 22:29:18 CDT 2023


PETSc developers,

When I fail to have matching PetscFunctionBeginUser() and PetscFunctionReturn() in my code, I get segfaults and valgrind reports invalid writes at places in PETSc where memory is freed. As a result, it is difficult to track down the actual source of the error. I know there used to be a command line argument for checking for mismatches in PetscFunctionBeginUser() and PetscFunctionReturn(), but Matt said it is no longer implemented and the reporting is supposed to be automatic when debugging is turned on. This automatic reporting does not seem to be working for me.

Is there a test in PETSc of this automatic reporting that I can run to verify it works in my build?

Are there any additional requirements for this automatic reporting of mismatched PetscFunctionBeginUser() and PetscFunctionReturn() in my code? Must I wrap all PETSc function calls with PetscCall()?

Thanks,
Brad

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20230712/0e762d6d/attachment.html>


More information about the petsc-users mailing list