public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gmx dot de" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libfortran/31001]  New: PACK crashes on zero-sized arrays
Date: Wed, 28 Feb 2007 22:16:00 -0000	[thread overview]
Message-ID: <bug-31001-6318@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2007-02-28 22:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-28 22:16 anlauf at gmx dot de [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-31001-6318@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).