2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / deallocate_alloc_opt_1.f90
blob5c00741f61c8bca510a5ac201cadd2c760ed74ec
1 ! { dg-do compile }
2 program a
4 implicit none
6 real x
7 integer j, k, n(4)
8 character(len=70) err
9 character(len=70), allocatable :: error(:)
11 integer, allocatable :: i(:)
13 type b
14 integer, allocatable :: c(:), d(:)
15 end type b
17 type(b) e, f(3)
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 "must be a scalar CHARACTER" }
27 deallocate(err) ! { dg-error "nonprocedure pointer or an allocatable" }
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" }
32 deallocate(n) ! { dg-error "must be ALLOCATABLE or a POINTER" }
34 deallocate(i, i) ! { dg-error "Allocate-object at" }
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)
40 end program a