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

            Bug ID: 94377
           Summary: Won't compile when deallocating a parameterized
                    derived type
           Product: gcc
           Version: 9.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: siteg at mathalacarte dot com
  Target Milestone: ---

Below is the code with the problem.

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

Here is the compilation.

gfortran -g -o pdt pdt.f90
pdt.f90:20:0:

   20 |       deallocate(av, stat=ista)
      | 
internal compiler error: in gimplify_var_or_parm_decl, at gimplify.c:2755
0x7f446356f1a2 __libc_start_main
        ../csu/libc-start.c:308

Reply via email to