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/58620] New: [OOP] Defined assignment not called for TYPE when the type's extension is used
Date: Fri, 04 Oct 2013 16:34:00 -0000	[thread overview]
Message-ID: <bug-58620-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 58620
           Summary: [OOP] Defined assignment not called for TYPE when the
                    type's extension is used
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: burnus at gcc dot gnu.org

Follow up to PR58469

The code below prints "42" as the defined assignment "assign0" isn't called for
"foo". If one uses "type(component)" instead of "type(comp0)" for "foo", one
gets the expected output: "20".

See also https://groups.google.com/forum/#!topic/comp.lang.fortran/6cW1K0Zj1gU

pgf95 and ifort ICEs for the code; using crayftn one gets the same result as
with gfortran - namely "20".

module m0
  implicit none
  type :: component
    integer :: i = 42
  contains
    procedure :: assign0
    generic :: assignment(=) => assign0
  end type
  type, extends(component) :: comp2
    real :: aa
  end type comp2
  type parent
    type(comp2) :: foo
  end type
contains
  elemental subroutine assign0(lhs,rhs)
    class(component), intent(INout) :: lhs
    class(component), intent(in) :: rhs
    lhs%i = 20
  end subroutine
end module

program main
  use m0
  implicit none
  type(parent), allocatable :: left
  type(parent) :: right
  left = right
  print *, left%foo
  if (left%foo%i /= 20) call abort()
end


             reply	other threads:[~2013-10-04 16:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-04 16:34 burnus at gcc dot gnu.org [this message]
2014-03-22 15:27 ` [Bug fortran/58620] " 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-58620-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).