<div dir="ltr">Hello,<div><br></div><div>I am in the process of updating my code to use PETSc versions >=3.22. (I am using v3.22.3 compiled with GCC on Perlmutter-CPU at NERSC for debugging at this time.) After updating all the Fortran function calls that have changed from v3.21 to v3.22 I am now getting segfaults in some PETSc routines. In the two instances I was able to identify, the problem seems to be calling the PETSc function with a PETSc variable that has been initialized to PETSC_NULL_XX:</div><div><span style="color:rgba(0,0,0,0.85);font-family:Menlo;font-size:12px"><br></span></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><span style="color:rgba(0,0,0,0.85);font-family:Menlo;font-size:12px">solver%rhs</span><span style="font-family:Menlo;font-size:12px;color:rgb(28,0,207)">2</span><span style="color:rgba(0,0,0,0.85);font-family:Menlo;font-size:12px">_mat = PETSC_NULL_MAT</span></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)">[...]</p></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)"><span style="color:rgb(155,35,147)"><b>call</b></span> MatDuplicate(solver%Amat,MAT_DO_NOT_COPY_VALUES,solver%rhs<span style="color:rgb(28,0,207)">2</span>_mat,ierr)</p></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)">--> Segfault</p></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)"><br></p></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)">solver%ksp<span class="gmail-Apple-converted-space">      </span>= PETSC_NULL_KSP</p></div><div><p style="margin:0px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)">[...]</p></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)"><span style="color:rgb(155,35,147)"><b>call</b></span> KSPCreate(solver%comm,solver%ksp,ierr)</p></div><div><p style="margin:0px;font-size:12px;line-height:normal;font-family:Menlo;font-size-adjust:none;font-kerning:auto;font-variant-alternates:normal;font-variant-ligatures:normal;font-variant-numeric:normal;font-variant-east-asian:normal;font-feature-settings:normal;color:rgba(0,0,0,0.85)">--> Segfault</p></div></blockquote><div><font face="Menlo"><span style="color:rgba(0,0,0,0.85);font-size:12px"><br></span></font></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif">When I comment out the assignments to PETSC_NULL_XX in the above examples, the code works just fine.</font></span></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif"><br></font></span></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif">Is this the intended behavior or a bug that you might have fixed by now?</font></span></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif"><br></font></span></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif">Best,</font></span></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif"><br></font></span></div><div><span style="color:rgba(0,0,0,0.85);font-size:12px"><font face="arial, sans-serif">Robert</font></span></div></div>