public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/39189] New: Improvement in handling COMMON'ed pointers to allocatable arrays
@ 2009-02-14 2:04 boldin dot pavel at gmail dot com
2009-02-14 16:00 ` [Bug fortran/39189] " kargl at gcc dot gnu dot org
2009-02-19 5:40 ` pault at gcc dot gnu dot org
0 siblings, 2 replies; 3+ messages in thread
From: boldin dot pavel at gmail dot com @ 2009-02-14 2:04 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-02-19 5:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-14 2:04 [Bug fortran/39189] New: Improvement in handling COMMON'ed pointers to allocatable arrays boldin dot pavel at gmail dot com
2009-02-14 16:00 ` [Bug fortran/39189] " kargl at gcc dot gnu dot org
2009-02-19 5:40 ` pault at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).