1! { dg-do compile }
2program a
3
4  implicit none
5
6  real x
7  integer j, k, n(4)
8  character(len=70) err
9  character(len=70), allocatable :: error(:)
10
11  integer, allocatable :: i(:)
12
13  type b
14    integer, allocatable :: c(:), d(:)
15  end type b
16
17  type(b) e, f(3)
18
19  deallocate(i, stat=x) ! { dg-error "must be a scalar INTEGER" }
20  deallocate(i, stat=j, stat=k) ! { dg-error "Redundant STAT" }
21  deallocate(i)
22  deallocate(i)) ! { dg-error "Syntax error in DEALLOCATE" }
23  deallocate(i, errmsg=err, errmsg=err) ! { dg-error "Redundant ERRMSG" }
24  deallocate(i, errmsg=err) ! { dg-warning "useless without a STAT" }
25  deallocate(i, stat=j, errmsg=x) ! { dg-error "shall be a scalar default CHARACTER" }
26
27  deallocate(err) ! { dg-error "nonprocedure pointer nor an allocatable" }
28
29  deallocate(error,stat=j,errmsg=error(1)) ! { dg-error "shall not be DEALLOCATEd within" }
30  deallocate(i, stat = i(1))  ! { dg-error "shall not be DEALLOCATEd within" }
31
32  deallocate(n) ! { dg-error "must be ALLOCATABLE or a POINTER" }
33
34  deallocate(i, i) ! { dg-error "Allocate-object at" }
35
36  ! These should not fail the check for duplicate alloc-objects.
37  deallocate(f(1)%c, f(2)%d)
38  deallocate(e%c, e%d)
39
40end program a
41