This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/41872] New: wrong-code: No auto-deallocation for INTENT(OUT) allocatable scalars


The following programs shows that the automatic deallocation is not applied to
allocatable INTENT(OUT) scalar dummies. It works for array arguments.

Note: For optional arguments, one needs to make sure that the deallocation only
happens if the variable is present, cf. PR 41850.

program test
  implicit none
  integer, allocatable :: a
  allocate(a)
  call foo(a)
  if(.not. allocated(a)) call abort()
  if (a /= 5) call abort()
contains
  subroutine foo(a)
    integer, allocatable, intent(out) :: a
    if(allocated(a)) call abort()
    allocate(a)
    a = 5
  end subroutine foo
end program test


-- 
           Summary: wrong-code: No auto-deallocation for INTENT(OUT)
                    allocatable scalars
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: burnus at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]