public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/31001]  New: PACK crashes on zero-sized arrays
@ 2007-02-28 22:16 anlauf at gmx dot de
  2007-03-03 10:38 ` [Bug libfortran/31001] " fxcoudert at gcc dot gnu dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: anlauf at gmx dot de @ 2007-02-28 22:16 UTC (permalink / raw)
  To: gcc-bugs

Hi,

the following legal program crashes with a segfault at runtime:

program gfcbug60
  implicit none

  integer :: i, j
  integer, allocatable :: mm(:)
  logical, allocatable :: mask(:)

  do i = 1, 0, -1
     print *, "i =", j
     allocate (mm(i), mask(i))
     mm(:) = 1
     mask(:) = (mm == 0)
     j = count (mask)
     print *, "j =", j
     print *, "mm =", mm
     print *, "mask =", mask
     ! gfortran runtime crash for i=j=0: bug in pack for 0-sized arrays!
     print *, "pack (mm, mask) =", pack (mm, mask)
     deallocate (mm, mask)
     print *
  end do
end program gfcbug60

% gfc gfcbug60.f90 && ./a.out
 i =           0
 j =           0
 mm =           1
 mask = F
 pack (mm, mask) =

 i =           0
 j =           0
 mm =
 mask =
Segmentation fault (core dumped)


-- 
           Summary: PACK crashes on zero-sized arrays
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: anlauf at gmx dot de
  GCC host triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31001


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

end of thread, other threads:[~2007-03-14 10:49 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-28 22:16 [Bug libfortran/31001] New: PACK crashes on zero-sized arrays anlauf at gmx dot de
2007-03-03 10:38 ` [Bug libfortran/31001] " fxcoudert at gcc dot gnu dot org
2007-03-03 14:24 ` fxcoudert at gcc dot gnu dot org
2007-03-03 16:38 ` fxcoudert at gcc dot gnu dot org
2007-03-04  7:20 ` [Bug libfortran/31001] [4.1/4.2 only] " fxcoudert at gcc dot gnu dot org
2007-03-05  4:11 ` mmitchel at gcc dot gnu dot org
2007-03-08 12:35 ` fxcoudert at gcc dot gnu dot org
2007-03-14 10:49 ` [Bug libfortran/31001] [4.1 " fxcoudert 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).