public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/58620] New: [OOP] Defined assignment not called for TYPE when the type's extension is used
@ 2013-10-04 16:34 burnus at gcc dot gnu.org
  2014-03-22 15:27 ` [Bug fortran/58620] " dominiq at lps dot ens.fr
  0 siblings, 1 reply; 2+ messages in thread
From: burnus at gcc dot gnu.org @ 2013-10-04 16:34 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug fortran/58620] [OOP] Defined assignment not called for TYPE when the type's extension is used
  2013-10-04 16:34 [Bug fortran/58620] New: [OOP] Defined assignment not called for TYPE when the type's extension is used burnus at gcc dot gnu.org
@ 2014-03-22 15:27 ` dominiq at lps dot ens.fr
  0 siblings, 0 replies; 2+ messages in thread
From: dominiq at lps dot ens.fr @ 2014-03-22 15:27 UTC (permalink / raw)
  To: gcc-bugs

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

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-03-22
     Ever confirmed|0                           |1

--- Comment #1 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
Still present at r208765.


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

end of thread, other threads:[~2014-03-22 15:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-04 16:34 [Bug fortran/58620] New: [OOP] Defined assignment not called for TYPE when the type's extension is used burnus at gcc dot gnu.org
2014-03-22 15:27 ` [Bug fortran/58620] " 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).