[Bug fortran/52864] [4.6/4.7/4.8 Regression] Assignment to pointer component for INTENT(IN) dummy argument

nnc at lanl dot gov gcc-bugzilla@gcc.gnu.org
Wed Apr 11 22:46:00 GMT 2012


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52864

Neil Carlson <nnc at lanl dot gov> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nnc at lanl dot gov

--- Comment #2 from Neil Carlson <nnc at lanl dot gov> 2012-04-11 22:45:36 UTC ---
Here's a somewhat different example, but I think it exposes the same underlying
bug.  Here's the error message:

    call bar (a%ptr)
              1
Error: Procedure argument at (1) is INTENT(IN) while interface specifies
INTENT(INOUT)

For pointer components of an argument, intent applies to the pointer itself
(i.e., changes in its association status) and NOT the target of the pointer.
This is a fundamental defect in the compiler.

module modA
  type :: typeA
    integer, pointer :: ptr
  end type
contains
  subroutine foo (a)
    type(typeA), intent(in) :: a
    call bar (a%ptr)
  end subroutine
  subroutine bar (n)
    integer, intent(inout) :: n
  end subroutine
end module



More information about the Gcc-bugs mailing list