Dear PETSc,

On Tuesday I sent a small reproducer program that shows a problem with the 
Fortran version of DMCompositeGetGlobalISs, with the valgrind stack trace below.

Not having yet received a reply, I’m just wondering if perhaps my email slipped 
through the cracks.

Would appreciate some guidance here so we can continue our code upgrade from 
petsc  3.19 to 3.23.

Thanks, Randy


> On Jun 18, 2025, at 2:44 PM, Randall Mackie <rlmackie...@gmail.com> wrote:
> 
> Follow up: running with valgrind shows the following issues….is this a bug in 
> PETSc?
> 
> ==5216== Use of uninitialised value of size 8
> ==5216==    at 0x49ED69C: f90array1dcreatefortranaddr_ (f90_fwrap.F90:52)
> ==5216==    by 0x4D7EA94: F90Array1dCreate (f90_cwrap.c:140)
> ==5216==    by 0x6B7295A: dmcompositegetglobaliss_ (zfddaf.c:70)
> ==5216==    by 0x1095C8: MAIN__ (test.F90:35)
> ==5216==    by 0x1096AC: main (test.F90:4)
> ==5216==  Uninitialised value was created by a stack allocation
> ==5216==    at 0x109219: MAIN__ (test.F90:1)
> ==5216==
> ==5216== Invalid write of size 8
> ==5216==    at 0x49ED69C: f90array1dcreatefortranaddr_ (f90_fwrap.F90:52)
> ==5216==    by 0x4D7EA94: F90Array1dCreate (f90_cwrap.c:140)
> ==5216==    by 0x6B7295A: dmcompositegetglobaliss_ (zfddaf.c:70)
> ==5216==    by 0x1095C8: MAIN__ (test.F90:35)
> ==5216==    by 0x1096AC: main (test.F90:4)
> ==5216==  Address 0x20 is not stack'd, malloc'd or (recently) free'd
> ==5216==
> 
> 
> Thanks, Randyt
> 
> 
> 
>> On Jun 17, 2025, at 3:39 PM, Randall Mackie <rlmackie...@gmail.com> wrote:
>> 
>> Dear Petsc users -
>> 
>> 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.
>> 
>> The example program listed on the man page for DMCompositeGetGlobalISs, 
>> https://urldefense.us/v3/__https://petsc.org/release/src/snes/tutorials/ex73f90t.F90.html__;!!G_uCfscf7eWS!Z2gkoRqGs_off3mdHshweKBv_JQzRrYyYBMN7hIRUHEZIypl2PnZFuidgVHE4iuK9FNlN1y4PtlNyahPNhcFiO1S2w$
>>  , seems to indicate that a call to DMCompositeGetGlobalISs does not need to 
>> allocate the IS pointer and you just pass it directly to 
>> DMCompositeGetGlobalISs.
>> 
>> If I compile and run the simple attached test program (say on 2 processes), 
>> I get the following error:
>> 
>> [0]PETSC ERROR: 
>> ------------------------------------------------------------------------
>> [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation, 
>> probably memory access out of range
>> [0]PETSC ERROR: Try option -start_in_debugger or -on_error_attach_debugger
>> [0]PETSC ERROR: or see 
>> https://urldefense.us/v3/__https://petsc.org/release/faq/*valgrind__;Iw!!G_uCfscf7eWS!Z2gkoRqGs_off3mdHshweKBv_JQzRrYyYBMN7hIRUHEZIypl2PnZFuidgVHE4iuK9FNlN1y4PtlNyahPNhdiZKy11Q$
>>   and 
>> https://urldefense.us/v3/__https://petsc.org/release/faq/__;!!G_uCfscf7eWS!Z2gkoRqGs_off3mdHshweKBv_JQzRrYyYBMN7hIRUHEZIypl2PnZFuidgVHE4iuK9FNlN1y4PtlNyahPNhdzXsvxLQ$
>>  
>> [0]PETSC ERROR: ---------------------  Stack Frames 
>> ------------------------------------
>> [0]PETSC ERROR: The line numbers in the error traceback may not be exact.
>> [0]PETSC ERROR: #1 F90Array1dCreate() at 
>> /home/rmackie/PETSc/petsc-3.23.3/src/sys/ftn-custom/f90_cwrap.c:123
>> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
>> 
>> 
>> If I uncomment the line to allocate the pointer, I get a very long traceback 
>> with lots of error messages.
>> 
>> 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?
>> 
>> Thanks,
>> 
>> Randy Mackie
>> 
>> <test.F90>
> 

Reply via email to