This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/51052] [OOP] Internal compiler error in gfc_conv_component


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

janus at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2011-11-09
     Ever Confirmed|0                           |1

--- Comment #2 from janus at gcc dot gnu.org 2011-11-09 13:45:12 UTC ---
Here is an very much reduced (and corrected) test case. This is another case of
"non-trivial polymorphic operands", cf. PR46262 and PR46328.

Arjen, why do you need those workarounds for 4.6?



module points2d3d

  implicit none

  type point2d
      real :: x, y
  contains
      procedure               :: add_vector_2d
      procedure               :: assign_2d
      generic                 :: operator(+)     => add_vector_2d
      generic                 :: assignment(=)   => assign_2d
  end type

contains

  subroutine assign_2d( point1, point2 )
    class(point2d), intent(inout) :: point1
    class(point2d), intent(in)    :: point2
    point1%x = point2%x
    point1%y = point2%y
  end subroutine

  function add_vector_2d( point, vector )
    class(point2d), intent(in)  :: point, vector
    class(point2d), allocatable :: add_vector_2d
    ! Workaround for gfortran 4.6
    if ( allocated( add_vector_2d ) ) then
        deallocate( add_vector_2d )
    endif
    allocate( add_vector_2d )
    add_vector_2d%x = point%x + vector%x
    add_vector_2d%y = point%y + vector%y
  end function

end module points2d3d



  use points2d3d
  implicit none

contains

  subroutine position_oil_particle()
    class(point2d), pointer      :: position
    type(point2d)                :: p1, p2
    position = position + p1 + p2
  end subroutine

end


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]