[Bug fortran/94377] Won't compile when deallocating a parameterized derived type

siteg at mathalacarte dot com gcc-bugzilla@gcc.gnu.org
Sat Mar 28 22:12:59 GMT 2020


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

--- Comment #2 from Fred Krogh <siteg at mathalacarte dot com> ---
I'm sorry, I made an error when making up this code from a much bigger one. 
There was a missing ')' at line 8.  I've corrected this in the code below. 
Same kind of error here, but that code compiles on both Intel and NAG according
to a friend.

program pdt
  type :: av_t(n)
    integer, len :: n
    integer :: i   real :: c
    real :: u(n)
  end type av_t
  type(av_t(:)), allocatable :: av(:)
  integer :: k2, k3
  k2 = 3
  k3 = 5
contains
  subroutine al_test(k)
    integer, intent(in) :: k
    integer :: ista
    if (k == 1)  then
      allocate ( av_t(k2) :: av(k3), stat=ista) ! For this ista not needed
      return
    else
      deallocate(av, stat=ista)
    end if
  end subroutine al_test
end program pdt


More information about the Gcc-bugs mailing list