43 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12module m3 real, allocatable :: xa4 real, allocatable, managed :: ma5 contains6 attributes(device) subroutine devsubr7 real, device, allocatable :: da8 real, allocatable, managed :: dma9 allocate(da) ! ok10 deallocate(da) ! ok11 allocate(dma) ! ok12 deallocate(dma) ! ok13 !ERROR: Name in ALLOCATE statement is not definable14 !BECAUSE: 'xa' is a host variable and is not definable in a device subprogram15 allocate(xa)16 !ERROR: Name in DEALLOCATE statement is not definable17 !BECAUSE: 'xa' is a host variable and is not definable in a device subprogram18 deallocate(xa)19 !ERROR: Name in ALLOCATE statement is not definable20 !BECAUSE: 'ma' is a host-associated allocatable and is not definable in a device subprogram21 allocate(ma)22 !ERROR: Name in DEALLOCATE statement is not definable23 !BECAUSE: 'ma' is a host-associated allocatable and is not definable in a device subprogram24 deallocate(ma)25 end subroutine26 27 subroutine hostsub()28 integer, allocatable, device :: ia(:)29 logical :: plog30 31 !WARNING: Object in ALLOCATE should have PINNED attribute when PINNED option is specified32 allocate(ia(100), pinned = plog)33 end subroutine34 35 subroutine host2()36 integer, allocatable, pinned :: ia(:)37 integer :: istream38 39 !ERROR: Object in ALLOCATE must have DEVICE attribute when STREAM option is specified40 allocate(ia(100), stream = istream)41 end subroutine42end module43