public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/32217]  New: gfortran segfaults on UNPACK with zero-sized arrays
@ 2007-06-05  7:55 highegg at gmail dot com
  2007-06-05 17:30 ` [Bug fortran/32217] segfaults (at runtime) " burnus at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: highegg at gmail dot com @ 2007-06-05  7:55 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-07-08 22:23 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-05  7:55 [Bug fortran/32217] New: gfortran segfaults on UNPACK with zero-sized arrays highegg at gmail dot com
2007-06-05 17:30 ` [Bug fortran/32217] segfaults (at runtime) " burnus at gcc dot gnu dot org
2007-06-16  8:09 ` tkoenig at gcc dot gnu dot org
2007-06-22 22:16 ` tkoenig at gcc dot gnu dot org
2007-07-08 15:42 ` dominiq at lps dot ens dot fr
2007-07-08 21:30 ` patchapp at dberlin dot org
2007-07-08 22:20 ` tkoenig at gcc dot gnu dot org
2007-07-08 22:23 ` tkoenig at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).