Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / unpack_zerosize_1.f90
blob8a41f5d9de1aa1265daea309a02de579d8c179cb
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