------- Comment #2 from burnus at gcc dot gnu dot org  2010-01-06 13:57 -------
The following also looks bogus:
  static struct t a = {.i=4};
Though, it seems to work - contrary to the version in comment 0.

program test
  implicit none
  type t
    integer :: i = 4
    integer, allocatable :: a(:)
  end type t
  call sub (0)
  call sub (1)
  call sub (2)
contains
  subroutine sub (no)
    integer, intent(in) :: no
    type(t), save :: a
    if (no == 0) then
      if (allocated (a%a)) call abort ()
      allocate (a%a(1))
    else if (no == 1) then
      if (.not. allocated (a%a)) call abort ()
      deallocate (a%a)
    else
      if (allocated (a%a)) call abort ()
    end if
  end subroutine sub
end program test


-- 


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

Reply via email to