http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46100
Summary: Non-variable pointer expression as actual argument to
INTENT(OUT) non-pointer dummy
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Reported at c.l.f by Thomas Jahns:
http://groups.google.com/group/comp.lang.fortran/browse_thread/thread
/a64e2f255466a87a
GNU Fortran (and most other compilers) reject passing a non-variable pointer
expression as actual argument to an INTENT(OUT)/INTENT(INOUT) non-pointer dummy
argument.
The reason for rejecting is that the pointer expression (i.e. a function
returning a pointer) itself is not definable. However, I believe now that it
the code is valid. Thus, only if the argument were a pointer dummy or the
expression were not a pointer expression, it would be invalid.
Example:
call one (two ())
contains
subroutine one (x)
integer, intent(inout) :: x
end subroutine one
function two ()
integer, pointer :: two
allocate(two)
end function two
end
Error message:
call one (two ())
1
Error: Non-variable expression in variable definition context (actual argument
to INTENT = OUT/INOUT) at (1)