[Bug fortran/68227] ICE on using variable limit in forall header (gfc_do_allocate)

gerhard.steinmetz.fortran@t-online.de gcc-bugzilla@gcc.gnu.org
Thu Nov 5 20:59:00 GMT 2015


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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fortran@t-online.de> ---
Of course, above code works with :
   forall (i=1:n) y(i)%a => x


But it works too, if above n is replaced with literal value 2 :

$ cat y3.f90
program p
   type t
   end type
   type t2
      type(t), pointer :: a
   end type

   type(t), target :: x
   type(t2), pointer :: y(:)
   integer :: i

   allocate (y(2))
   forall (i=1:2) y(i)%a = x   !

   print *, y(1)%a
   print *, y(2)%a
end


$ gfortran -g -O0 -Wall -fcheck=all y3.f90
$ a.out


More information about the Gcc-bugs mailing list