2020-05-12 02:38:53 +08:00
|
|
|
! RUN: %S/test_errors.sh %s %t %f18
|
2019-02-14 23:59:20 +08:00
|
|
|
subroutine s1
|
2019-08-07 04:48:13 +08:00
|
|
|
!ERROR: Array 'z' without ALLOCATABLE or POINTER attribute must have explicit shape
|
2019-02-14 23:59:20 +08:00
|
|
|
common x, y(4), z(:)
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s2
|
|
|
|
common /c1/ x, y, z
|
|
|
|
!ERROR: 'y' is already in a COMMON block
|
|
|
|
common y
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s3
|
2020-08-25 03:53:44 +08:00
|
|
|
!ERROR: 'x' may not be a procedure as it is in a COMMON block
|
2019-02-14 23:59:20 +08:00
|
|
|
procedure(real) :: x
|
|
|
|
common x
|
|
|
|
common y
|
2020-08-25 03:53:44 +08:00
|
|
|
!ERROR: 'y' may not be a procedure as it is in a COMMON block
|
2019-02-14 23:59:20 +08:00
|
|
|
procedure(real) :: y
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s5
|
|
|
|
integer x(2)
|
|
|
|
!ERROR: The dimensions of 'x' have already been declared
|
|
|
|
common x(4), y(4)
|
|
|
|
!ERROR: The dimensions of 'y' have already been declared
|
|
|
|
real y(2)
|
|
|
|
end
|
|
|
|
|
2019-02-21 09:45:39 +08:00
|
|
|
function f6(x) result(r)
|
2019-02-14 23:59:20 +08:00
|
|
|
!ERROR: Dummy argument 'x' may not appear in a COMMON block
|
|
|
|
!ERROR: ALLOCATABLE object 'y' may not appear in a COMMON block
|
|
|
|
common x,y,z
|
|
|
|
allocatable y
|
2019-02-21 09:45:39 +08:00
|
|
|
!ERROR: Function result 'r' may not appear in a COMMON block
|
|
|
|
common r
|
2019-02-14 23:59:20 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
module m7
|
2019-02-19 03:39:46 +08:00
|
|
|
!ERROR: Variable 'w' with BIND attribute may not appear in a COMMON block
|
2019-02-14 23:59:20 +08:00
|
|
|
!ERROR: Variable 'z' with BIND attribute may not appear in a COMMON block
|
2019-02-19 03:39:46 +08:00
|
|
|
common w,z
|
2019-02-14 23:59:20 +08:00
|
|
|
integer, bind(c) :: z
|
2019-02-19 03:39:46 +08:00
|
|
|
integer, bind(c,name="w") :: w
|
2019-02-14 23:59:20 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
module m8
|
|
|
|
type t
|
|
|
|
end type
|
|
|
|
class(*), pointer :: x
|
|
|
|
!ERROR: Unlimited polymorphic pointer 'x' may not appear in a COMMON block
|
|
|
|
!ERROR: Unlimited polymorphic pointer 'y' may not appear in a COMMON block
|
|
|
|
common x, y
|
|
|
|
class(*), pointer :: y
|
|
|
|
end
|
|
|
|
|
|
|
|
module m9
|
|
|
|
integer x
|
|
|
|
end
|
|
|
|
subroutine s9
|
|
|
|
use m9
|
|
|
|
!ERROR: 'x' is use-associated from module 'm9' and cannot be re-declared
|
|
|
|
common x
|
|
|
|
end
|
|
|
|
|
|
|
|
module m10
|
|
|
|
type t
|
|
|
|
end type
|
|
|
|
type(t) :: x
|
|
|
|
!ERROR: Derived type 'x' in COMMON block must have the BIND or SEQUENCE attribute
|
|
|
|
common x
|
|
|
|
end
|
|
|
|
|
|
|
|
module m11
|
|
|
|
type t1
|
|
|
|
sequence
|
|
|
|
integer, allocatable :: a
|
|
|
|
end type
|
|
|
|
type t2
|
|
|
|
sequence
|
|
|
|
type(t1) :: b
|
|
|
|
integer:: c
|
|
|
|
end type
|
|
|
|
type(t2) :: x2
|
|
|
|
!ERROR: Derived type variable 'x2' may not appear in a COMMON block due to ALLOCATABLE component
|
|
|
|
common x2
|
|
|
|
end
|
|
|
|
|
|
|
|
module m12
|
|
|
|
type t1
|
|
|
|
sequence
|
|
|
|
integer :: a = 123
|
|
|
|
end type
|
|
|
|
type t2
|
|
|
|
sequence
|
|
|
|
type(t1) :: b
|
|
|
|
integer:: c
|
|
|
|
end type
|
|
|
|
type(t2) :: x2
|
|
|
|
!ERROR: Derived type variable 'x2' may not appear in a COMMON block due to component with default initialization
|
|
|
|
common x2
|
|
|
|
end
|
2019-02-19 03:39:46 +08:00
|
|
|
|
|
|
|
subroutine s13
|
|
|
|
block
|
|
|
|
!ERROR: COMMON statement is not allowed in a BLOCK construct
|
|
|
|
common x
|
|
|
|
end block
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s14
|
|
|
|
!ERROR: 'c' appears as a COMMON block in a BIND statement but not in a COMMON statement
|
|
|
|
bind(c) :: /c/
|
|
|
|
end
|