Debian Codegraph @

gcc/testsuite/gfortran.dg/allocate_alloc_opt_11.f90

raw
1 ! { dg-do compile }
2 !
3 ! PR fortran/44556
4 !
5 ! Contributed by Jonathan Hogg and Steve Kargl.
6 !
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
15
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