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: "janus at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 12 Oct 2011 20:44:27 +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 #3 from janus at gcc dot gnu.org 2011-10-12 20:44:27 UTC ---
(In reply to comment #1)
>
> That won't work for:
>
> type(t), intent(in) :: dt
> call move_alloc(dt%allocatable, ...)
>
> That's invalid as dt%allocatable is intent(in);
I have to admit that I hadn't really thought about this comment yet, but now
that I do, I think the patch actually works for this case, assuming you mean
the following:
TYPE MY_TYPE
INTEGER, ALLOCATABLE :: VALUE
END TYPE
CONTAINS
SUBROUTINE sub (dt)
type(MY_TYPE), intent(in) :: dt
INTEGER, ALLOCATABLE :: lv
call move_alloc(dt%VALUE, lv)
END SUBROUTINE
end
This was rejected before, and still is with my patch.
The reasoning of the patch is that one should only throw the error for
intent(in) pointers, if they are passed on without any sub-references, which I
would say is correct.