diff --git a/CMakeLists.txt b/CMakeLists.txt index 511f2cd..868cb15 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,7 +39,7 @@ if( CMAKE_Fortran_COMPILER_ID MATCHES "PGI|NVHPC" ) # Compilation works, but runtime segmentation faults occur (tested with pgi/17.7) set( FEATURE_FINAL_DEFAULT OFF ) else() - list( APPEND FCKIT_QUARANTAINED_TESTS fckit_test_shared_ptr ) + # list( APPEND FCKIT_QUARANTAINED_TESTS fckit_test_shared_ptr ) # deallocation of list of shared_ptr only seems to deallocate first entry endif() endif() diff --git a/src/tests/test_shared_ptr.F90 b/src/tests/test_shared_ptr.F90 index 0e564c6..c3a46a7 100644 --- a/src/tests/test_shared_ptr.F90 +++ b/src/tests/test_shared_ptr.F90 @@ -524,6 +524,11 @@ subroutine test_shared_object_allocatable( final_auto, deallocate_auto ) #else #define CRAY_WORKAROUND .false. #endif +#if defined(__NVCOMPILER) && FCKIT_HAVE_FINAL +#define NV_WORKAROUND .true. +#else +#define NV_WORKAROUND .false. +#endif subroutine test_shared_object_allocatable_list( final_auto, deallocate_auto ) @@ -556,12 +561,24 @@ subroutine test_shared_object_allocatable_list( final_auto, deallocate_auto ) write(0,'(A)') "Therefore we avoid the deallocate( list ) above, to make test pass." write(0,'(A)') "This means that with FCKIT_HAVE_FINAL turn on, we cannot manually call deallocate(list)" else + if (final_auto .and. NV_WORKAROUND ) then + write(0,*) " WARNING: nvidia workaround needed" + write(0,*) " + call list(2)%final()" + call list(2)%final() + endif deallocate( list ) endif endif write(0,'(A)') "~~~~~~~~~~~~~~~ END SCOPE ~~~~~~~~~~~~~~~" call end_scope() + + if (final_auto .and. deallocate_auto .and. NV_WORKAROUND ) then + write(0,*) " WARNING: nvidia workaround needed" + write(0,*) " + call list(2)%final()" + call list(2)%final() + endif + end subroutine TEST( test_shared_object_allocatable_list_auto_auto ) @@ -682,11 +699,23 @@ subroutine test_shared_object_pointer_list( final_auto, deallocate_auto ) if( .not. deallocate_auto ) then write(0,'(A)') "~~~~~~~~~~~~~~ DEALLOCATE ~~~~~~~~~~~~~~~" deallocate_called = .true. + if (final_auto .and. NV_WORKAROUND ) then + write(0,*) " WARNING: nvidia workaround needed" + write(0,*) " + call list(2)%final()" + call list(2)%final() + endif deallocate( list ) endif - + write(0,'(A)') "~~~~~~~~~~~~~~~ END SCOPE ~~~~~~~~~~~~~~~" call end_scope() + + if (final_auto .and. deallocate_auto .and. NV_WORKAROUND ) then + write(0,*) " WARNING: nvidia workaround needed" + write(0,*) " + call list(2)%final()" + call list(2)%final() + endif + if( associated(list) ) deallocate( list ) end subroutine @@ -787,6 +816,15 @@ subroutine test_shared_object_automatic_list( final_auto ) write(0,'(A)') "~~~~~~~~~~~~~~~ END SCOPE ~~~~~~~~~~~~~~~" call end_scope() + + if (final_auto .and. NV_WORKAROUND ) then + write(0,*) " WARNING: nvidia workaround needed" + write(0,*) " + call list(1)%final()" + call list(1)%final() + write(0,*) " + call list(2)%final()" + call list(2)%final() + endif + #endif end subroutine