This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/46100] New: Non-variable pointer expression as actual argument to INTENT(OUT) non-pointer dummy
- 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: Wed, 20 Oct 2010 16:43:59 +0000
- Subject: [Bug fortran/46100] New: Non-variable pointer expression as actual argument to INTENT(OUT) non-pointer dummy
- Auto-submitted: auto-generated
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: unassigned@gcc.gnu.org
ReportedBy: burnus@gcc.gnu.org
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)