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