public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/52270] New: [OOP] Polymorphic vars: wrong intent(in) check, passing nonptr variable to intent(in) ptr dummy
@ 2012-02-16  8:15 burnus at gcc dot gnu.org
  2012-02-16  9:57 ` [Bug fortran/52270] " burnus at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: burnus at gcc dot gnu.org @ 2012-02-16  8:15 UTC (permalink / raw)
  To: gcc-bugs

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: unassigned@gcc.gnu.org
        ReportedBy: burnus@gcc.gnu.org


>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


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-03-02 13:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-16  8:15 [Bug fortran/52270] New: [OOP] Polymorphic vars: wrong intent(in) check, passing nonptr variable to intent(in) ptr dummy burnus at gcc dot gnu.org
2012-02-16  9:57 ` [Bug fortran/52270] " burnus at gcc dot gnu.org
2012-02-21 13:38 ` burnus at gcc dot gnu.org
2012-03-02 13:08 ` burnus at gcc dot gnu.org
2012-03-02 13:35 ` burnus at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).