Second program causing an ICE

Janus Weil janus@gcc.gnu.org
Sun Feb 13 11:56:00 GMT 2011


Hi,

> here is the second program that causes an internal compiler error.
> This time the message includes the name of a routine -
> gfc+enforce_symbol_state in fortran/symbol.c
> (line 3482)

with current trunk I get:

       procedure ::  assign_square
                1
Error: Argument 'this' of 'assign_square' with PASS(this) at (1) must
be of the derived-type 'square'
f951: internal compiler error: in gfc_enforce_clean_symbol_state, at
fortran/symbol.c:3426


I think the error message complaining about PASS is justified. The ICE
goes away when getting rid of the other error message (i.e.
ICE-on-invalid). Here's a reduced version:

module geometrical_objects

   implicit none

   type, abstract :: shape
   end type shape

   type, extends(shape) :: rectangle
       real :: width, height
   end type rectangle

   type, extends(rectangle) :: square
   contains
       procedure ::  assign_square
   end type square

contains

  subroutine assign_rectangle( this, that )
    class(shape),     intent(inout) :: this
    class(rectangle), intent(in)    :: that
    select type( that )
      class is (rectangle)
    end select
  end subroutine assign_rectangle

  subroutine assign_square( this, that )
    class(shape),  intent(inout) :: this
    class(square), intent(in)    :: that
  end subroutine assign_square

end module geometrical_objects


Surely worth another PR. Thanks for reporting ...

Cheers,
Janus



More information about the Fortran mailing list