33 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Catch NULL() actual argument association with allocatable dummy argument3program test4 real, allocatable :: a5 !ERROR: NULL() actual argument 'NULL()' may not be associated with allocatable dummy argument dummy argument 'a=' that is INTENT(OUT) or INTENT(IN OUT)6 call foo0(null())7 !WARNING: NULL() actual argument 'NULL()' should not be associated with allocatable dummy argument dummy argument 'a=' without INTENT(IN) [-Wnull-actual-for-default-intent-allocatable]8 call foo1(null())9 !PORTABILITY: Allocatable dummy argument 'a=' is associated with NULL() [-Wnull-actual-for-allocatable]10 call foo2(null())11 call foo3(null()) ! ok12 !ERROR: Actual argument associated with INTENT(IN OUT) dummy argument 'a=' is not definable13 !BECAUSE: 'null(mold=a)' is a null pointer14 call foo0(null(mold=a))15 !WARNING: A null allocatable should not be associated with allocatable dummy argument 'a=' without INTENT(IN)16 call foo1(null(mold=a))17 call foo2(null(mold=a)) ! ok18 call foo3(null(mold=a)) ! ok19 contains20 subroutine foo0(a)21 real, allocatable, intent(in out) :: a22 end subroutine23 subroutine foo1(a)24 real, allocatable :: a25 end subroutine26 subroutine foo2(a)27 real, allocatable, intent(in) :: a28 end subroutine29 subroutine foo3(a)30 real, allocatable, optional :: a31 end subroutine32end33