47 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12! Tests actual/dummy pointer argument shape mismatches3module m4 contains5 subroutine s0(p)6 real, pointer, intent(in) :: p7 end8 subroutine s1(p)9 real, pointer, intent(in) :: p(:)10 end11 subroutine sa(p)12 real, pointer, intent(in) :: p(..)13 end14 subroutine sao(p)15 real, intent(in), optional, pointer :: p(..)16 end17 subroutine so(x)18 real, intent(in), optional :: x(..)19 end20 subroutine soa(a)21 real, intent(in), optional, allocatable :: a(..)22 end23 subroutine test24 real, pointer :: a0, a1(:)25 call s0(null(a0)) ! ok26 !ERROR: Rank of dummy argument is 0, but actual argument has rank 127 !ERROR: Rank of pointer is 0, but function result has rank 128 call s0(null(a1))29 !ERROR: Rank of dummy argument is 1, but actual argument has rank 030 !ERROR: Rank of pointer is 1, but function result has rank 031 call s1(null(a0))32 call s1(null(a1)) ! ok33 call sa(null(a0)) ! ok34 call sa(null(a1)) ! ok35 !ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL36 call sa(null())37 call sao ! ok38 !ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL39 call sao(null())40 call so ! ok41 call so(null()) ! ok42 call soa ! ok43 !ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL44 call soa(null())45 end46end47