URL
                    https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
                
            Subversion Repositories openrisc_me
[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gfortran.dg/] [pointer_check_5.f90] - Rev 302
Compare with Previous | Blame | View Log
! { dg-do run }! { dg-options "-fcheck=pointer" }! { dg-shouldfail "Unassociated/unallocated actual argument" }!! { dg-output ".*At line 46 .*Pointer actual argument 'getptr' is not associated" }!! PR fortran/40580!! Run-time check of passing deallocated/nonassociated actuals! to nonallocatable/nonpointer dummies.!! Check for function actuals!subroutine test1(a)integer :: aprint *, aend subroutine test1subroutine test2(a)integer :: a(2)print *, aend subroutine test2subroutine ppTest(f)implicit noneexternal fcall f()end subroutine ppTestProgram RunTimeCheckimplicit noneexternal :: test1, test2, ppTestprocedure(), pointer :: pptr! OKcall test1(getPtr(.true.))call test2(getPtrArray(.true.))call test2(getAlloc(.true.))! OK but fails due to PR 40593! call ppTest(getProcPtr(.true.))! call ppTest2(getProcPtr(.true.))! Invalid:call test1(getPtr(.false.))! call test2(getAlloc(.false.)) - fails because the check is inserted after! _gfortran_internal_pack, which fails with out of memory! call ppTest(getProcPtr(.false.)) - fails due to PR 40593! call ppTest2(getProcPtr(.false.)) - fails due to PR 40593containsfunction getPtr(alloc)integer, pointer :: getPtrlogical, intent(in) :: allocif (alloc) thenallocate (getPtr)getPtr = 1elsenullify (getPtr)end ifend function getPtrfunction getPtrArray(alloc)integer, pointer :: getPtrArray(:)logical, intent(in) :: allocif (alloc) thenallocate (getPtrArray(2))getPtrArray = 1elsenullify (getPtrArray)end ifend function getPtrArrayfunction getAlloc(alloc)integer, allocatable :: getAlloc(:)logical, intent(in) :: allocif (alloc) thenallocate (getAlloc(2))getAlloc = 2else if (allocated(getAlloc)) thendeallocate(getAlloc)end ifend function getAllocsubroutine sub()print *, 'Hello World'end subroutine subfunction getProcPtr(alloc)procedure(sub), pointer :: getProcPtrlogical, intent(in) :: allocif (alloc) thengetProcPtr => subelsenullify (getProcPtr)end ifend function getProcPtrsubroutine ppTest2(f)implicit noneprocedure(sub) :: fcall f()end subroutine ppTest2end Program RunTimeCheck

