<div dir="ltr">Thanks for the information, that clarifies quite a bit. Unfortunately I probably have a number of memory issues that are colliding that I need to clean up. <br><br>Thanks</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 21, 2022 at 3:18 PM Barry Smith <<a href="mailto:bsmith@petsc.dev">bsmith@petsc.dev</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><br></div> My understanding of Fortran bounds checking is that before each array access in Fortran it checks to see if the index is valid for the array you are accessing; that is it is from start to end if you had declared the array as <div><br></div><div> double precision, <span style="font-size:15px;background-color:rgb(238,238,238);box-sizing:border-box">dimension </span><span style="font-size:15px;background-color:rgb(238,238,238);box-sizing:border-box;color:rgb(102,102,0)">(start:end</span><span style="font-size:15px;background-color:rgb(238,238,238);box-sizing:border-box;color:rgb(102,102,0)">)</span> :: A</div><div><br></div><div> It should also work if the array is a Fortran allocatable array or if you obtain the array from PETSc with VecGetArrayF90() and all its friends and relations.</div><div><br></div><div> PETSc should not change the behavior above.</div><div><br></div><div> Now if there is memory corruption (or some other error) somewhere else (like in PETSc or a more subtle problem in your code) then simply array out of bounds then yes you can get more complicated error messages that would usually include the PETSc stack trace. </div><div><br></div><div> Instead of using valgrind you can also try running the PETSc program with -malloc_debug, this is sort of a poor person's version of valgrind but can sometimes provide more useful information than valgrind.</div><div><br></div><div> When debugging always make sure PETSc was NOT ./configure with --with-debugging=0 </div><div><br></div><div> You can send specific error messages that are cryptic to <a href="mailto:petsc-maint@mcs.anl.gov" target="_blank">petsc-maint@mcs.anl.gov</a> and we may be able to help decipher them.</div><div><br></div><div> Barry</div><div><br></div><div><br></div><div><br></div><div><br><div><br><blockquote type="cite"><div>On Nov 21, 2022, at 2:16 PM, Nicholas Arnold-Medabalimi <<a href="mailto:narnoldm@umich.edu" target="_blank">narnoldm@umich.edu</a>> wrote:</div><br><div><div dir="ltr">Hi Petsc users<br><br>I'm working on an integration of Petsc into an existing fortran code. Most of my memory debugging is very primitive and is usually accomplished using the -check bounds option in the compiler. However with Petsc attached the stack trace becomes much more opaque compared to the original code. At least as far as I can tell the error becomes much harder to pin down (just pointing to libpetsc.so). Any assistance in getting more informative error messages or checks would be much appreciated.<br><br>Sincerely<br>Nicholas<br><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial;font-size:small"><font>Nicholas Arnold-Medabalimi<br><br></font><span style="font-family:sans-serif;font-size:14px">Ph.D. Candidate</span><font><br>Computational Aeroscience Lab<br>University of Michigan</font></div></div></div></div></div></div>
</div></blockquote></div><br></div></div></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div style="font-family:arial;font-size:small"><font color="#000000">Nicholas Arnold-Medabalimi<br><br></font><span style="font-family:sans-serif;font-size:14px">Ph.D. Candidate</span><font color="#000000"><br>Computational Aeroscience Lab<br>University of Michigan</font></div></div></div></div></div>