<div class="gmail_quote">On Thu, Apr 19, 2012 at 11:32, Randall Mackie <span dir="ltr"><<a href="mailto:rlmackie862@gmail.com">rlmackie862@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word">I still get the same error message. Can you try /src/ksp/ksp/examples/tutorials/ex2f.F, but replace the<div>call to KSPBuildSolution line 348 to</div><div><br></div><div> call KSPMonitorTrueResidualNorm(ksp,n,rnorm,dummy,ierr)</div>
<div><div><br></div><div>That will reproduce the error.</div></div></div></blockquote></div><br><div>Okay, this is much more clear. I do not know a way to pass PETSC_NULL_OBJECT through Fortran without interaction from the Fortran side. The reason is that (dummy .eq. PETSC_NULL_OBJECT) compares by value, but the reference is actually passed. So</div>
<div><br></div><div>dummy = PETSC_NULL_OBJECT</div><div>call Anything(dummy)</div><div><br></div><div>is different from</div><div><br></div><div>call Anything(PETSC_NULL_OBJECT)</div><div><br></div><div><br></div><div>The current code is dangerous because (in the NULL case), the address of "dummy" comes into the Fortran routine as 0x0, so anything that uses its value will dereference that bad pointer. We can pass mctx?mctx:PETSC_NULL_OBJECT_Fortran so that we never pass raw 0x0, but the Fortran side would still have to test for equality to PETSC_NULL_OBJECT and make the call differently. Can anyone think of a better way?</div>