The following valid program ends up in a segfault at the UNPACK function call with gfortran 4.3.0 20070605 (experimental binaries from gcc site): program bug_report implicit none integer,parameter:: rp = kind(1.d0),na = 6 real(rp),allocatable:: hhe(:,:,:),hhc(:,:,:),dv(:) integer:: nhh,ndv nhh = 0 allocate(hhe(nhh,2,2)) ndv = 2*na + count(hhe /= 0) allocate(hhc(nhh,2,2),dv(ndv)) print *,'OK' hhc = unpack(dv(2*na+1:),hhe /= 0._rp,0._rp) print *,'OK' end program
Also reproducible with gfortran 4.2.0 on x86_64 and IA64. Although the F2003 standard does not explicitly cover zero-sized arguments to UNPACK; however, I think that from the text it follows logically that the result should be zero-sized array. With nhh > 0, the program is working fine. cheers to all gfortran developers, Jaroslav Hajek -- Summary: gfortran segfaults on UNPACK with zero-sized arrays Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: highegg at gmail dot com GCC host triplet: i386-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32217