1! RUN: %python %S/test_errors.py %s %flang_fc1 2! Tests actual/dummy pointer argument shape mismatches 3module m 4 contains 5 subroutine s0(p) 6 real, pointer, intent(in) :: p 7 end 8 subroutine s1(p) 9 real, pointer, intent(in) :: p(:) 10 end 11 subroutine sa(p) 12 real, pointer, intent(in) :: p(..) 13 end 14 subroutine sao(p) 15 real, intent(in), optional, pointer :: p(..) 16 end 17 subroutine so(x) 18 real, intent(in), optional :: x(..) 19 end 20 subroutine soa(a) 21 real, intent(in), optional, allocatable :: a(..) 22 end 23 subroutine test 24 real, pointer :: a0, a1(:) 25 call s0(null(a0)) ! ok 26 !ERROR: Rank of dummy argument is 0, but actual argument has rank 1 27 !ERROR: Rank of pointer is 0, but function result has rank 1 28 call s0(null(a1)) 29 !ERROR: Rank of dummy argument is 1, but actual argument has rank 0 30 !ERROR: Rank of pointer is 1, but function result has rank 0 31 call s1(null(a0)) 32 call s1(null(a1)) ! ok 33 call sa(null(a0)) ! ok 34 call sa(null(a1)) ! ok 35 !ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL 36 call sa(null()) 37 call sao ! ok 38 !ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL 39 call sao(null()) 40 call so ! ok 41 call so(null()) ! ok 42 call soa ! ok 43 !ERROR: NULL() without MOLD= must not be associated with an assumed-rank dummy argument that is ALLOCATABLE, POINTER, or non-OPTIONAL 44 call soa(null()) 45 end 46end 47