public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/57530] New: [OOP] Wrongly rejects  type_pointer => class_target (which have identical declared type)
Date: Tue, 04 Jun 2013 19:06:00 -0000	[thread overview]
Message-ID: <bug-57530-4@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2013-06-04 19:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-04 19:06 burnus at gcc dot gnu.org [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-57530-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).