<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Follow up: running with valgrind shows the following issues….is this a bug in PETSc?<div><br></div><div><div>==5216== Use of uninitialised value of size 8</div><div>==5216==    at 0x49ED69C: f90array1dcreatefortranaddr_ (f90_fwrap.F90:52)</div><div>==5216==    by 0x4D7EA94: F90Array1dCreate (f90_cwrap.c:140)</div><div>==5216==    by 0x6B7295A: dmcompositegetglobaliss_ (zfddaf.c:70)</div><div>==5216==    by 0x1095C8: MAIN__ (test.F90:35)</div><div>==5216==    by 0x1096AC: main (test.F90:4)</div><div>==5216==  Uninitialised value was created by a stack allocation</div><div>==5216==    at 0x109219: MAIN__ (test.F90:1)</div><div>==5216==</div><div>==5216== Invalid write of size 8</div><div>==5216==    at 0x49ED69C: f90array1dcreatefortranaddr_ (f90_fwrap.F90:52)</div><div>==5216==    by 0x4D7EA94: F90Array1dCreate (f90_cwrap.c:140)</div><div>==5216==    by 0x6B7295A: dmcompositegetglobaliss_ (zfddaf.c:70)</div><div>==5216==    by 0x1095C8: MAIN__ (test.F90:35)</div><div>==5216==    by 0x1096AC: main (test.F90:4)</div><div>==5216==  Address 0x20 is not stack'd, malloc'd or (recently) free'd</div><div>==5216==</div><div><br></div><div><br></div><div>Thanks, Randyt</div><div><br></div><div><br></div><div><br><blockquote type="cite"><div>On Jun 17, 2025, at 3:39 PM, Randall Mackie <rlmackie862@gmail.com> wrote:</div><br class="Apple-interchange-newline"><div><meta http-equiv="content-type" content="text/html; charset=us-ascii"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Dear Petsc users -<div><br></div><div>I am trying to upgrade my code to petsc-3.23 (from 3.19), and I seem to have run into a problem with DMCompositeGetGlobalISs.</div><div><br></div><div>The example program listed on the man page for DMCompositeGetGlobalISs, <a href="https://urldefense.us/v3/__https://petsc.org/release/src/snes/tutorials/ex73f90t.F90.html__;!!G_uCfscf7eWS!bm0O_rjMssXigJJ70W-MVHCpKJyZbomZ-493v0TAJHAGdJgTS8zhtJTfPhN84ty778IefJ_7k2D6EqiHLBIIsoR5QA$">https://petsc.org/release/src/snes/tutorials/ex73f90t.F90.html</a>, seems to indicate that a call to DMCompositeGetGlobalISs does not need to allocate the IS pointer and you just pass it directly to DMCompositeGetGlobalISs.</div><div><br></div><div>If I compile and run the simple attached test program (say on 2 processes), I get the following error:</div><div><br></div><div><div>[0]PETSC ERROR: ------------------------------------------------------------------------</div><div>[0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, probably memory access out of range</div><div>[0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger</div><div>[0]PETSC ERROR: or see <a href="https://urldefense.us/v3/__https://petsc.org/release/faq/*valgrind__;Iw!!G_uCfscf7eWS!bm0O_rjMssXigJJ70W-MVHCpKJyZbomZ-493v0TAJHAGdJgTS8zhtJTfPhN84ty778IefJ_7k2D6EqiHLBJU3XEgSQ$">https://petsc.org/release/faq/#valgrind</a> and <a href="https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!bm0O_rjMssXigJJ70W-MVHCpKJyZbomZ-493v0TAJHAGdJgTS8zhtJTfPhN84ty778IefJ_7k2D6EqiHLBJR1nT-VA$">https://petsc.org/release/faq/</a></div><div>[0]PETSC ERROR: ---------------------  Stack Frames ------------------------------------</div><div>[0]PETSC ERROR: The line numbers in the error traceback may not be exact.</div><div>[0]PETSC ERROR: #1 F90Array1dCreate() at /home/rmackie/PETSc/petsc-3.23.3/src/sys/ftn-custom/f90_cwrap.c:123</div><div>application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0</div></div><div><br></div><div><br></div><div>If I uncomment the line to allocate the pointer, I get a very long traceback with lots of error messages.</div><div><br></div><div>What is the correct way to use DMCompositeGetGlobalISs in Fortran? With or without the pointer allocation, and what is the right way to do this without the errors it seems to generate?</div><div><br></div><div>Thanks,</div><div><br></div><div>Randy Mackie</div><div><br></div><div></div></div><span id="cid:0DDB8F79-8BC0-4F40-A1BF-4444D386860D"><test.F90></span><meta http-equiv="content-type" content="text/html; charset=us-ascii"><div style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;"><div></div></div></div></blockquote></div><br></div></body></html>