1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for semantic errors in ALLOCATE statements
4 ! Creating a symbol that allocate should accept
10 ! Creating symbols that allocate should not accept
12 real, allocatable
:: x
14 procedure
, pass
:: foo
=> mfoo
15 procedure
, pass
:: bar
=> mbar
21 class(a_type
), allocatable
:: foo
29 subroutine C932(ed1
, ed5
, ed7
, edc9
, edc10
, okad1
, okpd1
, okacd5
)
30 ! Each allocate-object shall be a data pointer or an allocatable variable.
32 use :: m
, only
: a_type
34 integer, allocatable
:: ok(:)
38 integer, pointer :: ok
50 real , target
:: e4
, ed5(:)
51 real , parameter :: e6
= 5.
52 procedure(foo
), pointer :: proc_ptr1
=> NULL()
53 procedure(bar
), pointer :: proc_ptr2
56 type(TestType1
) edc9
[*]
57 type(TestType2
) edc10
[*]
58 class(a_type
), allocatable
:: a_var
60 real, allocatable
:: oka1(:, :), okad1(:, :), oka2
61 real, pointer :: okp1(:, :), okpd1(:, :), okp2
62 real, pointer, save :: okp3
63 real, allocatable
, save :: oka3
, okac4
[:,:]
64 real, allocatable
:: okacd5(:, :)[:]
66 !ERROR: Name in ALLOCATE statement must be a variable name
68 !ERROR: Name in ALLOCATE statement must be a variable name
70 !ERROR: Name in ALLOCATE statement must be a variable name
72 !ERROR: Name in ALLOCATE statement must be a variable name
74 !ERROR: Name in ALLOCATE statement must be a variable name
76 !ERROR: Name in ALLOCATE statement must be a variable name
78 !ERROR: Name in ALLOCATE statement must be a variable name
81 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
83 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
85 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
87 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
89 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
91 !ERROR: Name in ALLOCATE statement must be a variable name
93 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
95 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
97 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
99 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
101 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
103 !ERROR: Entity in ALLOCATE statement must have the ALLOCATABLE or POINTER attribute
106 ! No errors expected below:
109 allocate(oka1(5, 7), okad1(4, 8), oka2
)
110 allocate(okp1(5, 7), okpd1(4, 8), okp2
)
111 allocate(okp1(5, 7), okpd1(4, 8), okp2
)
113 allocate(okac4
[2:4,4:*])
114 allocate(okacd5(1:2,3:4)[5:*])