brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · 7e29fb7 Raw
52 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! Test 15.5.2.7 constraints and restrictions for POINTER dummy arguments.3 4module m5  real :: coarray(10)[*]6 contains7 8  subroutine s01(p)9    real, pointer, contiguous, intent(in) :: p(:)10  end subroutine11  subroutine s02(p)12    real, pointer :: p(:)13  end subroutine14  subroutine s03(p)15    real, pointer, intent(in) :: p(:)16  end subroutine17  subroutine s04(p)18    real, pointer :: p19  end subroutine20 21  subroutine test22    !PORTABILITY: CONTIGUOUS entity 'a01' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]23    real, pointer, contiguous :: a01 ! C83024    real, pointer :: a02(:)25    real, target :: a03(10)26    real :: a04(10) ! not TARGET27    !PORTABILITY: CONTIGUOUS entity 'scalar' should be an array pointer, assumed-shape, or assumed-rank [-Wredundant-contiguous]28    real, contiguous :: scalar29    call s01(a03) ! ok30    !ERROR: CONTIGUOUS pointer dummy argument may not be associated with non-CONTIGUOUS pointer actual argument31    call s01(a02)32    !WARNING: Target of CONTIGUOUS pointer association is not known to be contiguous [-Wpointer-to-possible-noncontiguous]33    call s01(a02(:))34    !ERROR: CONTIGUOUS pointer may not be associated with a discontiguous target35    call s01(a03(::2))36    call s02(a02) ! ok37    call s03(a03) ! ok38    !ERROR: Actual argument associated with POINTER dummy argument 'p=' must also be POINTER unless INTENT(IN)39    call s02(a03)40    !ERROR: Actual argument associated with POINTER dummy argument 'p=' must also be POINTER unless INTENT(IN)41    call s04(a02(1))42    !ERROR: An array section with a vector subscript may not be a pointer target43    call s03(a03([1,2,4]))44    !ERROR: A coindexed object may not be a pointer target45    call s03(coarray(:)[1])46    !ERROR: Target associated with dummy argument 'p=' must be a designator or a call to a pointer-valued function47    call s03([1.])48    !ERROR: In assignment to object dummy argument 'p=', the target 'a04' is not an object with POINTER or TARGET attributes49    call s03(a04)50  end subroutine51end module52