brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.6 KiB · f57dc17 Raw
80 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -pedantic2! A construct entity does not have the POINTER or ALLOCATABLE attribute,3! except in SELECT RANK.4 5subroutine test(up,ua,rp,ra)6  class(*), pointer :: up7  class(*), allocatable :: ua8  real, pointer :: rp(..)9  real, allocatable :: ra(..)10  real, target :: x11  real, pointer :: p12  real, allocatable :: a13  associate (s => p)14    !ERROR: The left-hand side of a pointer assignment is not definable15    !BECAUSE: 's' is not a pointer16    s => x17    !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute18    allocate(s)19    !ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute20    deallocate(s)21    !ERROR: 's' may not appear in NULLIFY22    !BECAUSE: 's' is not a pointer23    nullify(s)24  end associate25  select type(s => up)26  type is (real)27    !ERROR: The left-hand side of a pointer assignment is not definable28    !BECAUSE: 's' is not a pointer29    s => x30    !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute31    allocate(s)32    !ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute33    deallocate(s)34    !ERROR: 's' may not appear in NULLIFY35    !BECAUSE: 's' is not a pointer36    nullify(s)37  end select38  select rank(s => rp)39  rank(0)40    s => x ! ok41    allocate(s) ! ok42    deallocate(s) ! ok43    nullify(s) ! ok44  !ERROR: RANK (*) cannot be used when selector is POINTER or ALLOCATABLE45  rank(*)46  rank default47    !ERROR: The left-hand side of a pointer assignment must not be an assumed-rank dummy argument48    !ERROR: pointer 's' associated with object 'x' with incompatible type or shape49    s => x50    !ERROR: An assumed-rank dummy argument may not appear in an ALLOCATE statement51    allocate(s)52    deallocate(s) ! ok53    nullify(s) ! ok54  end select55  associate (s => a)56    !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute57    allocate(s)58    !ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute59    deallocate(s)60  end associate61  select type(s => ua)62  type is (real)63    !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute64    allocate(s)65    !ERROR: Name in DEALLOCATE statement must have the ALLOCATABLE or POINTER attribute66    deallocate(s)67  end select68  select rank(s => ra)69  rank(0)70    allocate(s) ! ok71    deallocate(s) ! ok72  !ERROR: RANK (*) cannot be used when selector is POINTER or ALLOCATABLE73  rank(*)74  rank default75    !ERROR: An assumed-rank dummy argument may not appear in an ALLOCATE statement76    allocate(s)77    deallocate(s) ! ok78  end select79end80