[Bug fortran/59765] [4.9 Regression] [OOP] ICE on valid with allocatable component

janus at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 10 22:59:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59765

--- Comment #4 from janus at gcc dot gnu.org ---
I think what happens is something like the following:

generate_finalization_wrapper currently produces code like this on the test
case:

type(mtd), pointer :: ptr
deallocate(ptr%u(:)%c)

This is certainly wrong. Feeding it back to gfortran yields:

  deallocate(ptr%u%c)
             1
Error: Component to the right of a part reference with nonzero rank must not
have the ALLOCATABLE attribute at (1)


For the test case here it is sufficient to just use

deallocate(ptr%u(1)%c)

but for longer arrays we need to generate a loop:

do i=...
  deallocate(ptr%u(i)%c)
end do



More information about the Gcc-bugs mailing list