This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/39189] New: Improvement in handling COMMON'ed pointers to allocatable arrays
- From: "boldin dot pavel at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 14 Feb 2009 02:04:05 -0000
- Subject: [Bug fortran/39189] New: Improvement in handling COMMON'ed pointers to allocatable arrays
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
When using perverted technique like:
SUBROUTINE A
INTEGER, ALLOCATABLE, DIMENSION(:), TARGET :: ARRAY
INTEGER, POINTER, DIMENSION(:) :: ARRAY_PTR
COMMON /AP/ ARRAY_PTR !for later use in another sub
ALLOCATE(ARRAY(10))
ARRAY = 10
ARRAY_PTR => ARRAY
END SUBROUTINE A
SUBROUTINE B
INTEGER, POINTER, DIMENSION(:) :: ARRAY_PTR
COMMON /AP/ ARRAY_PTR !for later use in another sub
print *, ARRAY_PTR(1)
END SUBROUTINE
one can figure out, that ARRAY will be free'd after finishing subroutine A
(because it was not SAVE'd). But gfortran still allows to play such a trick.
I think it would be nice to see warning in such case (pointing to data that
will be lost after this scope)
--
Summary: Improvement in handling COMMON'ed pointers to
allocatable arrays
Product: gcc
Version: 4.3.3
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: boldin dot pavel at gmail dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39189