OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / unpack_zerosize_1.f90
1 ! { dg-do run }
2 ! PR 32217 - unpack used to crash at runtime with a zero-sized
3 !            array.  Test case submitted by Jaroslav Hajek.
4 program bug_report
5   implicit none
6   integer,parameter:: rp = kind(1.d0),na = 6
7   real(rp),allocatable:: hhe(:,:,:),hhc(:,:,:),dv(:)
8   integer:: nhh,ndv
9   nhh = 0
10   allocate(hhe(nhh,2,2))
11   ndv = 2*na + count(hhe /= 0)
12   allocate(hhc(nhh,2,2),dv(ndv))
13   hhc = unpack(dv(2*na+1:),hhe /= 0._rp,0._rp)
14 end program bug_report