2020-05-12 02:38:53 +08:00
|
|
|
! RUN: %S/test_errors.sh %s %t %f18
|
2019-08-09 04:28:50 +08:00
|
|
|
! C1141
|
2019-10-12 05:39:33 +08:00
|
|
|
! A reference to the procedure IEEE_SET_HALTING_MODE ! from the intrinsic
|
|
|
|
! module IEEE_EXCEPTIONS, shall not ! appear within a DO CONCURRENT construct.
|
2019-08-09 04:28:50 +08:00
|
|
|
!
|
|
|
|
! C1137
|
|
|
|
! An image control statement shall not appear within a DO CONCURRENT construct.
|
|
|
|
!
|
2019-09-17 07:58:13 +08:00
|
|
|
! C1136
|
2019-08-09 04:28:50 +08:00
|
|
|
! A RETURN statement shall not appear within a DO CONCURRENT construct.
|
|
|
|
!
|
|
|
|
! (11.1.7.5), paragraph 4
|
|
|
|
! In a DO CONCURRENT, can't have an i/o statement with an ADVANCE= specifier
|
2018-09-18 08:19:27 +08:00
|
|
|
|
|
|
|
subroutine do_concurrent_test1(i,n)
|
|
|
|
implicit none
|
|
|
|
integer :: i, n
|
|
|
|
do 10 concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2018-09-18 08:19:27 +08:00
|
|
|
SYNC ALL
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2018-09-18 08:19:27 +08:00
|
|
|
SYNC IMAGES (*)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
SYNC MEMORY
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: RETURN is not allowed in DO CONCURRENT
|
2018-09-18 08:19:27 +08:00
|
|
|
return
|
|
|
|
10 continue
|
|
|
|
end subroutine do_concurrent_test1
|
|
|
|
|
|
|
|
subroutine do_concurrent_test2(i,j,n,flag)
|
2018-10-10 05:18:16 +08:00
|
|
|
use ieee_exceptions
|
2019-04-16 01:26:20 +08:00
|
|
|
use iso_fortran_env, only: team_type
|
2018-09-18 08:19:27 +08:00
|
|
|
implicit none
|
2019-09-17 07:58:13 +08:00
|
|
|
integer :: i, n
|
|
|
|
type(ieee_flag_type) :: flag
|
|
|
|
logical :: flagValue, halting
|
2019-04-16 01:26:20 +08:00
|
|
|
type(team_type) :: j
|
2019-12-24 09:12:53 +08:00
|
|
|
type(ieee_status_type) :: status
|
2018-09-18 08:19:27 +08:00
|
|
|
do concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
sync team (j)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2018-09-18 08:19:27 +08:00
|
|
|
change team (j)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
critical
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT
|
2019-12-24 09:12:53 +08:00
|
|
|
call ieee_get_status(status)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: IEEE_SET_HALTING_MODE is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
call ieee_set_halting_mode(flag, halting)
|
|
|
|
end critical
|
2018-09-18 08:19:27 +08:00
|
|
|
end team
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: ADVANCE specifier is not allowed in DO CONCURRENT
|
2018-09-18 08:19:27 +08:00
|
|
|
write(*,'(a35)',advance='no')
|
|
|
|
end do
|
2019-10-12 05:39:33 +08:00
|
|
|
|
|
|
|
! The following is OK
|
|
|
|
do concurrent (i = 1:n)
|
|
|
|
call ieee_set_flag(flag, flagValue)
|
|
|
|
end do
|
2018-09-18 08:19:27 +08:00
|
|
|
end subroutine do_concurrent_test2
|
2019-09-27 04:33:48 +08:00
|
|
|
|
|
|
|
subroutine s1()
|
|
|
|
use iso_fortran_env
|
|
|
|
type(event_type) :: x
|
|
|
|
do concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
event post (x)
|
|
|
|
end do
|
|
|
|
end subroutine s1
|
|
|
|
|
|
|
|
subroutine s2()
|
|
|
|
use iso_fortran_env
|
|
|
|
type(event_type) :: x
|
|
|
|
do concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
event wait (x)
|
|
|
|
end do
|
|
|
|
end subroutine s2
|
|
|
|
|
|
|
|
subroutine s3()
|
|
|
|
use iso_fortran_env
|
|
|
|
type(team_type) :: t
|
|
|
|
|
|
|
|
do concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
form team(1, t)
|
|
|
|
end do
|
|
|
|
end subroutine s3
|
|
|
|
|
|
|
|
subroutine s4()
|
|
|
|
use iso_fortran_env
|
|
|
|
type(lock_type) :: l
|
|
|
|
|
|
|
|
do concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
lock(l)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-09-27 04:33:48 +08:00
|
|
|
unlock(l)
|
|
|
|
end do
|
|
|
|
end subroutine s4
|
|
|
|
|
|
|
|
subroutine s5()
|
|
|
|
do concurrent (i = 1:n)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
stop
|
2019-09-27 04:33:48 +08:00
|
|
|
end do
|
|
|
|
end subroutine s5
|
2019-10-01 04:52:05 +08:00
|
|
|
|
|
|
|
subroutine s6()
|
|
|
|
type :: type0
|
|
|
|
integer, allocatable, dimension(:) :: type0_field
|
2019-10-30 03:46:25 +08:00
|
|
|
integer, allocatable, dimension(:), codimension[:] :: coarray_type0_field
|
2019-10-01 04:52:05 +08:00
|
|
|
end type
|
|
|
|
|
|
|
|
type :: type1
|
|
|
|
type(type0) :: type1_field
|
|
|
|
end type
|
|
|
|
|
2019-10-12 05:39:33 +08:00
|
|
|
type(type1) :: pvar;
|
|
|
|
type(type1) :: qvar;
|
2019-10-01 04:52:05 +08:00
|
|
|
integer, allocatable, dimension(:) :: array1
|
|
|
|
integer, allocatable, dimension(:) :: array2
|
2019-10-30 03:46:25 +08:00
|
|
|
integer, allocatable, codimension[:] :: ca, cb
|
2019-10-12 05:39:33 +08:00
|
|
|
integer, allocatable :: aa, ab
|
2019-10-01 04:52:05 +08:00
|
|
|
|
|
|
|
! All of the following are allowable outside a DO CONCURRENT
|
|
|
|
allocate(array1(3), pvar%type1_field%type0_field(3), array2(9))
|
|
|
|
allocate(pvar%type1_field%coarray_type0_field(3)[*])
|
|
|
|
allocate(ca[*])
|
2019-10-12 05:39:33 +08:00
|
|
|
allocate(ca[*], pvar%type1_field%coarray_type0_field(3)[*])
|
2019-10-01 04:52:05 +08:00
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
allocate(pvar%type1_field%type0_field(3))
|
2019-10-01 04:52:05 +08:00
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-10-01 04:52:05 +08:00
|
|
|
allocate(ca[*])
|
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
2019-10-01 04:52:05 +08:00
|
|
|
deallocate(ca)
|
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
allocate(pvar%type1_field%coarray_type0_field(3)[*])
|
2019-10-01 04:52:05 +08:00
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
deallocate(pvar%type1_field%coarray_type0_field)
|
2019-10-01 04:52:05 +08:00
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
allocate(ca[*], pvar%type1_field%coarray_type0_field(3)[*])
|
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
deallocate(ca, pvar%type1_field%coarray_type0_field)
|
|
|
|
end do
|
|
|
|
|
|
|
|
! Call to MOVE_ALLOC of a coarray outside a DO CONCURRENT. This is OK.
|
|
|
|
call move_alloc(ca, cb)
|
|
|
|
|
|
|
|
! Note that the errors below relating to MOVE_ALLOC() bing impure are bogus.
|
|
|
|
! They're the result of the fact that access to the move_alloc() instrinsic
|
|
|
|
! is not yet possible.
|
|
|
|
|
|
|
|
allocate(aa)
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT
|
|
|
|
call move_alloc(aa, ab)
|
|
|
|
end do
|
|
|
|
|
|
|
|
! Call to MOVE_ALLOC with non-coarray arguments in a DO CONCURRENT. This is OK.
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT
|
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
call move_alloc(ca, cb)
|
2019-10-01 04:52:05 +08:00
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
2019-10-12 05:39:33 +08:00
|
|
|
!ERROR: Call to an impure procedure is not allowed in DO CONCURRENT
|
|
|
|
!ERROR: An image control statement is not allowed in DO CONCURRENT
|
|
|
|
call move_alloc(pvar%type1_field%coarray_type0_field, qvar%type1_field%coarray_type0_field)
|
2019-10-01 04:52:05 +08:00
|
|
|
end do
|
|
|
|
end subroutine s6
|
2019-10-24 06:56:22 +08:00
|
|
|
|
|
|
|
subroutine s7()
|
|
|
|
interface
|
|
|
|
pure integer function pf()
|
|
|
|
end function pf
|
|
|
|
end interface
|
|
|
|
|
|
|
|
type :: procTypeNotPure
|
|
|
|
procedure(notPureFunc), pointer, nopass :: notPureProcComponent
|
|
|
|
end type procTypeNotPure
|
|
|
|
|
|
|
|
type :: procTypePure
|
|
|
|
procedure(pf), pointer, nopass :: pureProcComponent
|
|
|
|
end type procTypePure
|
|
|
|
|
|
|
|
type(procTypeNotPure) :: procVarNotPure
|
|
|
|
type(procTypePure) :: procVarPure
|
|
|
|
integer :: ivar
|
|
|
|
|
|
|
|
procVarPure%pureProcComponent => pureFunc
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
print *, "hello"
|
|
|
|
end do
|
|
|
|
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
ivar = pureFunc()
|
|
|
|
end do
|
|
|
|
|
|
|
|
! This should not generate errors
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
ivar = procVarPure%pureProcComponent()
|
|
|
|
end do
|
|
|
|
|
|
|
|
! This should generate an error
|
|
|
|
do concurrent (i = 1:10)
|
|
|
|
!ERROR: Call to an impure procedure component is not allowed in DO CONCURRENT
|
|
|
|
ivar = procVarNotPure%notPureProcComponent()
|
|
|
|
end do
|
|
|
|
|
|
|
|
contains
|
|
|
|
integer function notPureFunc()
|
|
|
|
notPureFunc = 2
|
|
|
|
end function notPureFunc
|
|
|
|
|
|
|
|
pure integer function pureFunc()
|
|
|
|
pureFunc = 3
|
|
|
|
end function pureFunc
|
|
|
|
|
|
|
|
end subroutine s7
|