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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  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 ` burnus at gcc dot gnu dot org
  2007-06-16  8:09 ` tkoenig at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: burnus at gcc dot gnu dot org @ 2007-06-05 17:30 UTC (permalink / raw)
  To: gcc-bugs



-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   GCC host triplet|i386-pc-linux-gnu           |
           Keywords|                            |wrong-code
      Known to fail|                            |4.3.0 4.2.0
   Last reconfirmed|0000-00-00 00:00:00         |2007-06-05 17:30:34
               date|                            |
            Summary|gfortran segfaults on UNPACK|segfaults (at runtime) on
                   |with zero-sized arrays      |UNPACK with zero-sized
                   |                            |arrays
   Target Milestone|---                         |4.3.0


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


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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-06-16  8:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from tkoenig at gcc dot gnu dot org  2007-06-16 08:09 -------
This one should be relatively easy.

I'll take it.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |tkoenig at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2007-06-05 17:30:34         |2007-06-16 08:09:12
               date|                            |


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


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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-06-22 22:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from tkoenig at gcc dot gnu dot org  2007-06-22 22:16 -------
Created an attachment (id=13765)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13765&action=view)
proposed patch

This fixes the test case.  It'll be a while before I
can regression-test and submit this, because I'm about
to go on holiday :-)

Thomas


-- 


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


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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  2007-06-05  7:55 [Bug fortran/32217] New: gfortran segfaults on UNPACK with zero-sized arrays highegg at gmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dominiq at lps dot ens dot fr @ 2007-07-08 15:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from dominiq at lps dot ens dot fr  2007-07-08 15:42 -------
> This fixes the test case.

Confirmed on PPC Darwin7 and it passes the regression-test on this platform.


-- 


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


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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  2007-06-05  7:55 [Bug fortran/32217] New: gfortran segfaults on UNPACK with zero-sized arrays highegg at gmail dot com
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: patchapp at dberlin dot org @ 2007-07-08 21:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from patchapp at dberlin dot org  2007-07-08 21:30 -------
Subject: Bug number PR 32217

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg00717.html


-- 


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


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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  2007-06-05  7:55 [Bug fortran/32217] New: gfortran segfaults on UNPACK with zero-sized arrays highegg at gmail dot com
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-07-08 22:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from tkoenig at gcc dot gnu dot org  2007-07-08 22:20 -------
Subject: Bug 32217

Author: tkoenig
Date: Sun Jul  8 22:20:04 2007
New Revision: 126469

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=126469
Log:
2007-07-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/32217
        * intrinsics/unpack_generic.c:  If the destination array is
        empty, return early.

2007-07-08  Thomas Koenig  <tkoenig@gcc.gnu.org>

        PR libfortran/32217
        * gfortran.dg/unpack_zerosize_1.f90:  New test case.


Added:
    trunk/gcc/testsuite/gfortran.dg/unpack_zerosize_1.f90
Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/libgfortran/ChangeLog
    trunk/libgfortran/intrinsics/unpack_generic.c


-- 


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


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

* [Bug fortran/32217] segfaults (at runtime) on UNPACK with zero-sized arrays
  2007-06-05  7:55 [Bug fortran/32217] New: gfortran segfaults on UNPACK with zero-sized arrays highegg at gmail dot com
                   ` (5 preceding siblings ...)
  2007-07-08 22:20 ` tkoenig at gcc dot gnu dot org
@ 2007-07-08 22:23 ` tkoenig at gcc dot gnu dot org
  6 siblings, 0 replies; 8+ messages in thread
From: tkoenig at gcc dot gnu dot org @ 2007-07-08 22:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from tkoenig at gcc dot gnu dot org  2007-07-08 22:23 -------
Fixed on mainline.

No plans to backport this to 4.2.


-- 

tkoenig at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED


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).