http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47545
Summary: ICE: in gfc_get_derived_type, at
fortran/trans-types.c:2145
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: [email protected]
ReportedBy: [email protected]
At revision 169415, the following code (probably invalid)
module astronaut_class
implicit none
private ! Hide everything by default
public :: astronaut ! Expose type & constructor
type astronaut
private
character(:), allocatable :: greeting
contains
procedure :: greet ! Public by default
end type
! interface astronaut ! Map generic to actual name
! procedure constructor
! end interface
contains
function constructor(new_greeting) result(new_astronaut)
character(len=*), intent(in) :: new_greeting
type(astronaut) :: new_astronaut
new_astronaut%greeting = new_greeting
end function
function greet(this) result(message)
class(astronaut), intent(in) :: this
character(:), allocatable :: message
message = this%greeting
end function
end module
program oo_hello_world
use astronaut_class ,only : astronaut
type(astronaut) :: pilot
pilot = astronaut('Hello, world!')
print *, pilot%greet()
end program
gives and ICE
f951: internal compiler error: in gfc_get_derived_type, at
fortran/trans-types.c:2145
If I remove the comments for the interface block, I get the following errors:
astronaut.f90:11.51:
interface astronaut ! Map generic to actual name
1
Error: DERIVED attribute of 'astronaut' conflicts with PROCEDURE attribute at
(1)
astronaut.f90:12.4:
procedure constructor
1
Error: Unclassifiable statement at (1)
astronaut.f90:13.5:
end interface
1
Error: Expecting END MODULE statement at (1)
astronaut.f90:29.39:
use astronaut_class ,only : astronaut
1
Fatal Error: Can't open module file 'astronaut_class.mod' for reading at (1):
No such file or directory