public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/35743]  New: allocate negative memory for zero-sized WHERE construct
@ 2008-03-28 21:23 dick dot hendrickson at gmail dot com
  2008-03-29  0:00 ` [Bug fortran/35743] " dfranke at gcc dot gnu dot org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: dick dot hendrickson at gmail dot com @ 2008-03-28 21:23 UTC (permalink / raw)
  To: gcc-bugs

The following program fails when rg0025 attempts to allocate a negative
amount of memory under windows XP.  It doesn't abort when the array
subscripts are explicit constants instead of variables.

Dick Hendrickson
      program try_rg0025
! fails on Windows XP
! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139]


      logical lda(5)
      lda = (/ (i/2*2 .ne. I, i=1,5) /)

      call       xx0025(lda,  1,  2,  3,  5,  6, -1, -2)   !works
      call       rg0025(lda,  1,  2,  3,  5,  6, -1, -2)   !fails

      end program

      SUBROUTINE XX0025(LDA,nf1,nf2,nf3,nf5,nf6,mf1,mf2)
      type unseq
            real  r
      end type unseq
      TYPE(UNSEQ) TDA1L(6)
      LOGICAL LDA(NF5)

      TDA1L(1:6)%r = 1.0

      WHERE (LDA(6:3))
        TDA1L(-1:5:-1) = TDA1L(6:2)
      ENDWHERE

      print *, 'end of xx0025'
      END SUBROUTINE

      SUBROUTINE RG0025(LDA,nf1,nf2,nf3,nf5,nf6,mf1,mf2)
      type unseq
            real  r
      end type unseq
      TYPE(UNSEQ) TDA1L(6)
      LOGICAL LDA(NF5)

      TDA1L(1:6)%r = 1.0

      WHERE (LDA(NF6:NF3))
        TDA1L(MF1:NF5:MF1) = TDA1L(NF6:NF2)
      ENDWHERE

      END SUBROUTINE

C:\g_experiments\gfortran>gfortran rg0025.f

C:g_experiments\gfortran>a
 end of xx0025
Fortran runtime error: Attempt to allocate a negative amount of memory.


-- 
           Summary: allocate negative memory for zero-sized WHERE construct
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: dick dot hendrickson at gmail dot com


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


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

end of thread, other threads:[~2008-05-17  7:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-28 21:23 [Bug fortran/35743] New: allocate negative memory for zero-sized WHERE construct dick dot hendrickson at gmail dot com
2008-03-29  0:00 ` [Bug fortran/35743] " dfranke at gcc dot gnu dot org
2008-03-31 15:15 ` dominiq at lps dot ens dot fr
2008-04-01  7:24 ` pault at gcc dot gnu dot org
2008-05-16 21:13 ` pault at gcc dot gnu dot org
2008-05-17  7:12 ` pault at gcc dot gnu dot org
2008-05-17  7:18 ` pault 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).