2020-05-12 02:38:53 +08:00
|
|
|
! RUN: %S/test_errors.sh %s %t %f18
|
2018-09-25 23:53:53 +08:00
|
|
|
! Construct names
|
|
|
|
|
|
|
|
subroutine s1
|
|
|
|
real :: foo
|
|
|
|
!ERROR: 'foo' is already declared in this scoping unit
|
|
|
|
foo: block
|
|
|
|
end block foo
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s2(x)
|
|
|
|
logical :: x
|
|
|
|
foo: if (x) then
|
|
|
|
end if foo
|
|
|
|
!ERROR: 'foo' is already declared in this scoping unit
|
|
|
|
foo: do i = 1, 10
|
|
|
|
end do foo
|
|
|
|
end
|
2018-10-18 22:55:48 +08:00
|
|
|
|
|
|
|
subroutine s3
|
|
|
|
real :: a(10,10), b(10,10)
|
|
|
|
type y; end type
|
|
|
|
integer(8) :: x
|
|
|
|
!ERROR: Index name 'y' conflicts with existing identifier
|
|
|
|
forall(x=1:10, y=1:10)
|
|
|
|
a(x, y) = b(x, y)
|
|
|
|
end forall
|
|
|
|
!ERROR: Index name 'y' conflicts with existing identifier
|
|
|
|
forall(x=1:10, y=1:10) a(x, y) = b(x, y)
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s4
|
|
|
|
real :: a(10), b(10)
|
|
|
|
complex :: x
|
2019-01-23 08:30:32 +08:00
|
|
|
integer :: i(2)
|
2019-04-26 04:18:33 +08:00
|
|
|
!ERROR: Must have INTEGER type, but is COMPLEX(4)
|
2018-10-18 22:55:48 +08:00
|
|
|
forall(x=1:10)
|
2019-04-26 04:18:33 +08:00
|
|
|
!ERROR: Must have INTEGER type, but is COMPLEX(4)
|
|
|
|
!ERROR: Must have INTEGER type, but is COMPLEX(4)
|
2018-10-18 22:55:48 +08:00
|
|
|
a(x) = b(x)
|
|
|
|
end forall
|
2019-04-26 04:18:33 +08:00
|
|
|
!ERROR: Must have INTEGER type, but is REAL(4)
|
2018-10-18 22:55:48 +08:00
|
|
|
forall(y=1:10)
|
2019-04-26 04:18:33 +08:00
|
|
|
!ERROR: Must have INTEGER type, but is REAL(4)
|
|
|
|
!ERROR: Must have INTEGER type, but is REAL(4)
|
2018-10-18 22:55:48 +08:00
|
|
|
a(y) = b(y)
|
|
|
|
end forall
|
2019-01-30 06:31:47 +08:00
|
|
|
!ERROR: Index variable 'i' is not scalar
|
2019-01-23 08:30:32 +08:00
|
|
|
forall(i=1:10)
|
|
|
|
a(i) = b(i)
|
|
|
|
end forall
|
2018-10-18 22:55:48 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s6
|
|
|
|
integer, parameter :: n = 4
|
|
|
|
real, dimension(n) :: x
|
|
|
|
data(x(i), i=1, n) / n * 0.0 /
|
|
|
|
!ERROR: Index name 't' conflicts with existing identifier
|
2019-01-23 08:30:32 +08:00
|
|
|
forall(t=1:n) x(t) = 0.0
|
2018-10-18 22:55:48 +08:00
|
|
|
contains
|
|
|
|
subroutine t
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-12-24 06:19:24 +08:00
|
|
|
subroutine s6b
|
|
|
|
integer, parameter :: k = 4
|
|
|
|
integer :: l = 4
|
|
|
|
forall(integer(k) :: i = 1:10)
|
|
|
|
end forall
|
2020-02-27 12:19:48 +08:00
|
|
|
! C713 A scalar-int-constant-name shall be a named constant of type integer.
|
2019-12-24 06:19:24 +08:00
|
|
|
!ERROR: Must be a constant value
|
|
|
|
forall(integer(l) :: i = 1:10)
|
|
|
|
end forall
|
|
|
|
end
|
|
|
|
|
2018-10-18 22:55:48 +08:00
|
|
|
subroutine s7
|
|
|
|
!ERROR: 'i' is already declared in this scoping unit
|
|
|
|
do concurrent(integer::i=1:5) local(j, i) &
|
|
|
|
!ERROR: 'j' is already declared in this scoping unit
|
|
|
|
local_init(k, j) &
|
|
|
|
shared(a)
|
2019-07-09 06:35:24 +08:00
|
|
|
a = j + 1
|
2018-10-18 22:55:48 +08:00
|
|
|
end do
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s8
|
|
|
|
implicit none
|
|
|
|
!ERROR: No explicit type declared for 'i'
|
|
|
|
do concurrent(i=1:5) &
|
|
|
|
!ERROR: No explicit type declared for 'j'
|
|
|
|
local(j) &
|
|
|
|
!ERROR: No explicit type declared for 'k'
|
|
|
|
local_init(k)
|
|
|
|
end do
|
|
|
|
end
|
2019-02-05 02:39:41 +08:00
|
|
|
|
|
|
|
subroutine s9
|
2019-06-28 03:33:36 +08:00
|
|
|
integer :: j
|
|
|
|
!ERROR: 'i' is already declared in this scoping unit
|
|
|
|
do concurrent(integer::i=1:5) shared(i) &
|
|
|
|
shared(j) &
|
|
|
|
!ERROR: 'j' is already declared in this scoping unit
|
|
|
|
shared(j)
|
|
|
|
end do
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s10
|
2019-02-05 02:39:41 +08:00
|
|
|
external bad1
|
2019-02-09 08:03:23 +08:00
|
|
|
real, parameter :: bad2 = 1.0
|
2019-02-05 02:39:41 +08:00
|
|
|
x = cos(0.)
|
|
|
|
do concurrent(i=1:2) &
|
2019-07-26 03:54:11 +08:00
|
|
|
!ERROR: 'bad1' may not appear in a locality-spec because it is not definable
|
2019-02-05 02:39:41 +08:00
|
|
|
local(bad1) &
|
2019-07-26 03:54:11 +08:00
|
|
|
!ERROR: 'bad2' may not appear in a locality-spec because it is not definable
|
2019-02-05 02:39:41 +08:00
|
|
|
local(bad2) &
|
2019-07-26 03:54:11 +08:00
|
|
|
!ERROR: 'bad3' may not appear in a locality-spec because it is not definable
|
2019-02-05 02:39:41 +08:00
|
|
|
local(bad3) &
|
2019-07-26 03:54:11 +08:00
|
|
|
!ERROR: 'cos' may not appear in a locality-spec because it is not definable
|
2019-02-05 02:39:41 +08:00
|
|
|
local(cos)
|
|
|
|
end do
|
2019-06-28 03:33:36 +08:00
|
|
|
do concurrent(i=1:2) &
|
2019-07-03 03:10:09 +08:00
|
|
|
!ERROR: The name 'bad1' must be a variable to appear in a locality-spec
|
2019-06-28 03:33:36 +08:00
|
|
|
shared(bad1) &
|
2019-07-03 03:10:09 +08:00
|
|
|
!ERROR: The name 'bad2' must be a variable to appear in a locality-spec
|
2019-06-28 03:33:36 +08:00
|
|
|
shared(bad2) &
|
2019-07-03 03:10:09 +08:00
|
|
|
!ERROR: The name 'bad3' must be a variable to appear in a locality-spec
|
2019-06-28 03:33:36 +08:00
|
|
|
shared(bad3) &
|
2019-07-03 03:10:09 +08:00
|
|
|
!ERROR: The name 'cos' must be a variable to appear in a locality-spec
|
2019-06-28 03:33:36 +08:00
|
|
|
shared(cos)
|
|
|
|
end do
|
2019-02-05 02:39:41 +08:00
|
|
|
contains
|
|
|
|
subroutine bad3
|
|
|
|
end
|
|
|
|
end
|