This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/50684] [4.6/4.7 Regression] Incorrect error for move_alloc on element inside intent(in) pointer
- From: "burnus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 13 Oct 2011 07:18:32 +0000
- Subject: [Bug fortran/50684] [4.6/4.7 Regression] Incorrect error for move_alloc on element inside intent(in) pointer
- Auto-submitted: auto-generated
- References: <bug-50684-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50684
--- Comment #9 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-10-13 07:18:32 UTC ---
(In reply to comment #8)
> Well, comment #5 is 'equivalent' to comment #3: Both have a non-pointer intent
> (which is what you suggested in your initial comment to my patch).
Pilot error: I read in comment 3 an nonexisting "POINTER" - without pointer
attribute, I concur that it should be invalid and analoguous to comment 5. -- I
shouldn't write replies around midnight.
* * *
I think the comments of the following program are correct; however, the
compilers I tested either rejected all - or they compiled it without warning.
Thus, I might have misunderstood something. On the other hand, if I change
"call move_alloc" to "deallocate", gfortran follows my invalid/OK pattern. I
have not checked whether it works with your patch, but I think it still rejects
(3).
subroutine test (x, px)
implicit none
type t
integer, allocatable :: a
end type t
type t2
type(t), pointer :: ptr
integer, allocatable :: a
end type t2
type(t2), intent(in) :: x
type(t2), pointer, intent(in) :: px
integer, allocatable :: a
type(t2), pointer :: ta
call move_alloc (tx, ta) ! Invalid (1)
call move_alloc (x%a, a) ! Invalid (2)
call move_alloc (x%ptr%a, a) ! OK (3)
call move_alloc (px%a, a) ! OK (4)
call move_alloc (px%ptr%a, a) ! OK (5)
end subroutine test