https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70068

            Bug ID: 70068
           Summary: ICE: out of memory on involving empty substring
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gerhard.steinmetz.fort...@t-online.de
  Target Milestone: ---

Looks strange, is legal (empty substring, zero length) :


$ cat z1.f90
program p
   character(99), parameter :: x(2) = ' '
   character(99), parameter :: y = x(2)(99:1)
end

$ gfortran-6 z1.f90
f951: out of memory allocating 18446744073709551232 bytes after a total of
634880 bytes



$ cat z2.f90
program p
   character(99), parameter :: x(2) = ' '
   character(99) :: y = x(2)(99:1)
end

$ gfortran-6 z2.f90
f951: out of memory allocating 18446744073709551232 bytes after a total of
626688 bytes



Compiles and works :

$ cat z3.f90
program p
   character(99), parameter :: x(2) = 'x'
   character(99) :: y
   y = x(2)(99:1)
   print *, y
end



Works with a scalar x instead of an array :

$ cat z4.f90
program p
   character(99), parameter :: x = ' '
   character(99), parameter :: y = x(99:1)
   print *, y
end

Reply via email to