1! RUN: %S/test_errors.sh %s %t %flang_fc1
2! REQUIRES: shell
3subroutine s1(x, y)
4  !ERROR: Array pointer 'x' must have deferred shape or assumed rank
5  real, pointer :: x(1:)  ! C832
6  !ERROR: Allocatable array 'y' must have deferred shape or assumed rank
7  real, dimension(1:,1:), allocatable :: y  ! C832
8end
9
10subroutine s2(a, b, c)
11  real :: a(:,1:)
12  real :: b(10,*)
13  real :: c(..)
14  !ERROR: Array pointer 'd' must have deferred shape or assumed rank
15  real, pointer :: d(:,1:)  ! C832
16  !ERROR: Allocatable array 'e' must have deferred shape or assumed rank
17  real, allocatable :: e(10,*)  ! C832
18  !ERROR: Assumed-rank array 'f' must be a dummy argument
19  real, pointer :: f(..)  ! C837
20  !ERROR: Assumed-shape array 'g' must be a dummy argument
21  real :: g(:,1:)
22  !ERROR: Assumed-size array 'h' must be a dummy argument
23  real :: h(10,*)  ! C833
24  !ERROR: Assumed-rank array 'i' must be a dummy argument
25  real :: i(..)  ! C837
26end
27
28subroutine s3(a, b)
29  real :: a(*)
30  !ERROR: Dummy array argument 'b' may not have implied shape
31  real :: b(*,*)  ! C835, C836
32  !ERROR: Implied-shape array 'c' must be a named constant or a dummy argument
33  real :: c(*)  ! C836
34  !ERROR: Named constant 'd' array must have constant or implied shape
35  integer, parameter :: d(:) = [1, 2, 3]
36end
37
38subroutine s4()
39  type :: t
40    integer, allocatable :: a(:)
41    !ERROR: Component array 'b' without ALLOCATABLE or POINTER attribute must have explicit shape
42    integer :: b(:)  ! C749
43    real, dimension(1:10) :: c
44    !ERROR: Array pointer component 'd' must have deferred shape
45    real, pointer, dimension(1:10) :: d  ! C745
46  end type
47end
48
49function f()
50  !ERROR: Array 'f' without ALLOCATABLE or POINTER attribute must have explicit shape
51  real, dimension(:) :: f  ! C832
52end
53
54subroutine s5()
55  !ERROR: Allocatable array 'a' must have deferred shape or assumed rank
56  integer :: a(10), b(:)
57  allocatable :: a
58  allocatable :: b
59end subroutine
60
61subroutine s6()
62!C835   An object whose array bounds are specified by an
63!  implied-shape-or-assumed-size-spec shall be a dummy data object or a named
64!  constant.
65!
66!C843   An entity with the INTENT attribute shall be a dummy data object or a
67!  dummy procedure pointer.
68!
69!C849   An entity with the OPTIONAL attribute shall be a dummy argument.
70
71  !ERROR: Implied-shape array 'local1' must be a named constant or a dummy argument
72  real, dimension (*) :: local1
73  !ERROR: INTENT attributes may apply only to a dummy argument
74  real, intent(in) :: local2
75  !ERROR: INTENT attributes may apply only to a dummy argument
76  procedure(), intent(in) :: p1
77  !ERROR: OPTIONAL attribute may apply only to a dummy argument
78  real, optional :: local3
79  !ERROR: OPTIONAL attribute may apply only to a dummy argument
80  procedure(), optional :: p2
81end subroutine
82