https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112424
Bug ID: 112424 Summary: libgomp: cuStreamSynchronize error: misaligned address Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgomp Assignee: unassigned at gcc dot gnu.org Reporter: patrick.be...@univ-grenoble-alpes.fr CC: jakub at gcc dot gnu.org Target Milestone: --- Created attachment 56523 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=56523&action=edit Line 39 'finalize' clause in 'exit data' directive is requested when deallocating local variable with gfortran (only) else the second call to the subroutine fails. In a Fortran + openacc subroutine, using a local allocatable array offloaded on the GPU requires the "finalize" clause in the "exit data" directive. Without this directive, the next call to the routine fails with: libgomp: cuStreamSynchronize error: misaligned address Provided code show a subroutine called "doinit" using a local "tmp" array offloaded. Line 39 the "finalize" clause is requested with gfortran (not with nvfortran or cray fortran). Without it the econd call to the routine fails. The main program calls twice the routine and check the values on the host before and after an update from the device to be sure we are executing on GPU. Gfortran is OG13 or 14 (GNU Fortran (GCC) 14.0.0 20231106 (experimental)) Tested on Nvidia A100 and AMD MI250 GPUs. Correct output with "finalize" clause line 39: Check on host OK Check values uploaded from GPU OK Check on host OK Check values uploaded from GPU OK Output without "finalize" clause line 39: Check on host OK Check values uploaded from GPU OK libgomp: cuStreamSynchronize error: misaligned address