<div dir="ltr"><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Dear PETSc-team,<br><br>I am using function PetscSFGetGraph in my program like<br>-----------------------<br>call PetscSFGetGraph(sf,gnroots,gnleaves,gmine,gremote,ierr)<br>-----------------------<br><br>In some cases, it works well. But in some cases, I encountered following error<br>------------------<br>PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range <br></pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">------------------</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">I found it is due to the action of reading gmine, which is a fortran pointer point to an array. It is reasonable because PETSc manual tells me "if returned value is NULL, it means leaves are in contiguous storage". The problem is that I cannot find if gmine is a null pointer. </pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">1)  I cannot use "if (gmine==PETSC_NULL_INTEGER)" because my intel compiler would return a compile error "A scalar-valued expression is required in this context"</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">2)  When using standard style of checking a null pointer in fortran, "associated(gmine)", it returns "T". Even in cases such action of "print *, gmine(1)" would give rise to above Segmentation Violation error.</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Is there any means to check the NULL pointer in Fortran in above cases.</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Many thanks,</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)">Yuan</pre><pre style="white-space:pre-wrap;color:rgb(0,0,0)"></pre></div>