public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/57530] New: [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
@ 2013-06-04 19:06 burnus at gcc dot gnu.org
  2013-06-05 12:50 ` [Bug fortran/57530] " burnus at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-06-04 19:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 57530
           Summary: [OOP] Wrongly rejects  type_pointer => class_target
                    (which have identical declared type)
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org
                CC: janus at gcc dot gnu.org

Found in the examples to http://www.cambridge.org/rouson (->
ssdSource/chapter05/hermetic). According to comments, the original program is
accepted by xlf2003 and nagf95.

The following simplified code is accepted by Crayftn, ifort and pgf95, but
rejected by gfortran with:

    ptr => tgt  ! TYPE => CLASS
    1
Error: Different types in pointer assignment at (1); attempted assignment of
CLASS(t) to TYPE(t)


>From F2008:

"C714 (R733) If data-target is not unlimited polymorphic, data-pointer-object
shall be type compatible (4.3.1.3) with it and the corresponding kind type
parameters shall be equal."

There (4.3.1.3): "A nonpolymorphic entity is type compatible only with entities
of the same declared type. A polymorphic entity that is not an unlimited
polymorphic entity is type compatible with entities of the same declared type
or any of its extensions."


In the example below, TYPE(t) and CLASS(t) have same declared type.


module m
  type t
  end type t
contains
  subroutine sub (tgt)
    class(t), target :: tgt
    type(t), pointer :: ptr
    ptr => tgt  ! TYPE => CLASS
  end subroutine sub
end module m


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

end of thread, other threads:[~2015-10-10  9:05 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-04 19:06 [Bug fortran/57530] New: [OOP] Wrongly rejects type_pointer => class_target (which have identical declared type) burnus at gcc dot gnu.org
2013-06-05 12:50 ` [Bug fortran/57530] " burnus at gcc dot gnu.org
2013-06-05 14:31 ` burnus at gcc dot gnu.org
2013-06-05 17:59 ` burnus at gcc dot gnu.org
2013-06-06 15:06 ` burnus at gcc dot gnu.org
2013-07-25 22:15 ` burnus at gcc dot gnu.org
2013-07-30  7:21 ` burnus at gcc dot gnu.org
2013-07-30  7:24 ` burnus at gcc dot gnu.org
2014-09-06 11:04 ` dominiq at lps dot ens.fr
2015-10-10  9:05 ` dominiq at lps dot ens.fr

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).