The code is invalid (13.14.89 says about NCOPIES
"Its value should not be negative), but the
error message could definitely be improved :-)

$ cat rep.f90
program main
  integer :: i
  character(len=10) :: from
  from = "-1"
  read(unit=from, fmt="(I10)") i
  print *,repeat ("a", i)
end program main
$ gfortran rep.f90
$ ./a.out
Fortran runtime error: Attempt to allocate a negative amount of memory.


-- 
           Summary: Confusing error message for negative ncopies in REPEAT
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: enhancement
          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=30611

Reply via email to