This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/41872] New: wrong-code: No auto-deallocation for INTENT(OUT) allocatable scalars
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Oct 2009 21:58:42 -0000
- Subject: [Bug fortran/41872] New: wrong-code: No auto-deallocation for INTENT(OUT) allocatable scalars
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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