2017-11-09 Steven G. Kargl <kargl@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_alloc_opt_11.f90
blobc8c7ac633cd2ddd2cf944db14fa7b405e0d87725
1 ! { dg-do compile }
3 ! PR fortran/44556
5 ! Contributed by Jonathan Hogg and Steve Kargl.
7 program oh_my
8 implicit none
9 type a
10 integer, allocatable :: b(:), d(:)
11 character(len=80) :: err
12 character(len=80), allocatable :: str(:)
13 integer :: src
14 end type a
16 integer j
17 type(a) :: c
18 c%err = 'ok'
19 allocate(c%d(1))
20 allocate(c%b(2), errmsg=c%err, stat=c%d(1)) ! OK
21 deallocate(c%b, errmsg=c%err, stat=c%d(1)) ! OK
22 allocate(c%b(2), errmsg=c%err, stat=c%b(1)) ! { dg-error "the same ALLOCATE statement" }
23 deallocate(c%b, errmsg=c%err, stat=c%b(1)) ! { dg-error "the same DEALLOCATE statement" }
24 allocate(c%str(2), errmsg=c%str(1), stat=j) ! { dg-error "the same ALLOCATE statement" }
25 deallocate(c%str, errmsg=c%str(1), stat=j) ! { dg-error "the same DEALLOCATE statement" }
26 end program oh_my