http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52270
Bug #: 52270
Summary: [OOP] Polymorphic vars: wrong intent(in) check,
passing nonptr variable to intent(in) ptr dummy
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: rejects-valid
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
>From http://j3-fortran.org/doc/meeting/197/12-131.txt
The following program is rejected with:
-----------------------------------------------------
p%c = 3
1
Error: Dummy argument 'p' with INTENT(IN) in variable definition context
(assignment) at (1)
Call s(x)
1
Error: Actual argument to 'p' at (1) must be polymorphic
-----------------------------------------------------
The first item is bogus as 'p' is a pointer and pointer intents only affect the
pointer association status. Something must go wrong with regards to polymorphic
types.
The second error is formally correct, but the quoted interpretation request by
Malcolm Cohen suggests to make it valid; that would be consistent with the
Fortran 2008 changes regarding "pointer,intent(in)". One could consider to
defer this part until it has passed J3 (or even WG3) voting.
Program m013
Type t
Real c
End Type
Type(t),Target :: x
Call s(x)
Print *,x%c
Contains
Subroutine s(p)
Class(t),Pointer,Intent(In) :: p
p%c = 3
End Subroutine
End Program