http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51634
Bug #: 51634
Summary: [OOP] ICE with polymorphic operators
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Keywords: ice-on-valid-code
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
Depends on: 46328, 51334
Related to PR 51334 and PR 46328, though the error message is slightly
different.
foo.f90:37:0: internal compiler error: tree check: expected function_type or
method_type, have pointer_type in gimplify_call_expr, at gimplify.c:2430
module field_module
implicit none
private
public :: field
type :: field
real, allocatable :: f(:)
contains
procedure :: multiply_real => multiply
procedure :: copy => copy_field
generic :: operator(*) => multiply_real
generic :: assignment(=) => copy
end type
contains
subroutine copy_field (lhs, rhs)
class(field), intent(inout) :: lhs
class(field), intent(in) :: rhs
lhs%f = rhs%f
end subroutine
function multiply(lhs,rhs)
class(field) ,intent(in) :: lhs
real ,intent(in) :: rhs
class(field) ,allocatable :: multiply
allocate(multiply)
multiply%f = lhs%f * rhs
end function
end module field_module
program main
use field_module
implicit none
type(field) :: f, g
real :: dt, half
dt = 7
half = 0.5
f = g * dt * half
end program main