$ cat a3.f90
program main
  integer, allocatable :: a(:)
  allocate (a(1:-1))
end program main
$ gfortran a3.f90
$ ./a.out
Fortran runtime error: Attempt to allocate negative amount of memory.  Possible
integer overflow
$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../../gcc/trunk/configure --prefix=/home/ig25
--enable-languages=c,fortran
Thread model: posix
gcc version 4.2.0 20060119 (experimental)

According to 6.3.1, this program should yield a zero-sized array.

Related to PR 25031 and PR 15335.


-- 
           Summary: allocate (a(1:-1)) should yield zero-sized array
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tkoenig at gcc dot gnu dot org


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

Reply via email to