This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/50684] [4.6/4.7 Regression] Incorrect error for move_alloc on element inside intent(in) pointer


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]