Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / deallocate01.f90
blobb224f30df456933d69d0253bd55518d835189c21
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Test that DEALLOCATE works
4 INTEGER, PARAMETER :: maxvalue=1024
6 Type dt
7 Integer :: l = 3
8 End Type
9 Type t
10 Type(dt),Pointer :: p
11 End Type
13 Type(t),Allocatable :: x(:)
14 Type(t),Pointer :: y(:)
15 Type(t),Pointer :: z
16 Integer :: s
17 CHARACTER(256) :: e
19 Integer, Pointer :: pi
21 Allocate(pi)
22 Allocate(x(3))
24 Deallocate(x(2)%p)
26 Deallocate(y(2)%p)
28 Deallocate(pi)
30 Deallocate(z%p)
32 !ERROR: An allocatable or pointer component reference must be applied to a scalar base
33 Deallocate(x%p, stat=s, errmsg=e)
34 Deallocate(x, errmsg=e)
35 Deallocate(x, stat=s)
37 Deallocate(y, stat=s, errmsg=e)
38 Deallocate(y, errmsg=e)
39 Deallocate(y, stat=s)
41 Deallocate(z, stat=s, errmsg=e)
42 Deallocate(z, errmsg=e)
43 Deallocate(z, stat=s)
45 Deallocate(z, y, stat=s, errmsg=e)
46 Deallocate(z, y, errmsg=e)
47 Deallocate(z, y, stat=s)
49 End Program