Bug 47545 - ICE: in gfc_get_derived_type, at fortran/trans-types.c:2145
ICE: in gfc_get_derived_type, at fortran/trans-types.c:2145
Status: RESOLVED DUPLICATE of bug 51976
Product: gcc
Classification: Unclassified
Component: fortran
4.6.0
: P3 normal
: ---
Assigned To: Not yet assigned to anyone
: ice-on-valid-code
: 48654 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-01-30 19:02 UTC by Dominique d'Humieres
Modified: 2012-01-24 08:04 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-04-17 21:23:44


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominique d'Humieres 2011-01-30 19:02:47 UTC
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
Comment 1 janus 2011-01-30 22:18:26 UTC
Reduced test case:


  type astronaut
    character(:), allocatable :: greeting
  end type

contains

  function constructor() result(new_astronaut)
    type(astronaut) :: new_astronaut
  end function

end
Comment 2 Tobias Burnus 2011-01-31 07:11:31 UTC
(In reply to comment #1)
>   type astronaut
>     character(:), allocatable :: greeting
>   end type

Deferred-length components are not yet supported, cf. bug 45170 comment 9.

Nevertheless, gfortran should not ICE.
Comment 3 Dominique d'Humieres 2011-04-17 21:22:15 UTC
*** Bug 48654 has been marked as a duplicate of this bug. ***
Comment 4 Dominique d'Humieres 2011-04-17 21:23:44 UTC
Confirmed by pr48654.
Comment 5 Tobias Burnus 2011-12-15 15:18:38 UTC
Author: burnus
Date: Thu Dec 15 15:18:33 2011
New Revision: 182372

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182372
Log:
2011-12-15  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51550
        PR fortran/47545
        PR fortran/49050
        PR fortran/51075
        * resolve.c (resolve_fl_derived0): Print not-implemented error
        for deferred-length character components.


Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/resolve.c
Comment 6 Tobias Burnus 2011-12-15 15:25:37 UTC
Author: burnus
Date: Thu Dec 15 15:25:32 2011
New Revision: 182373

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182373
Log:
2011-12-15  Tobias Burnus  <burnus@net-b.de>

        PR fortran/51550
        PR fortran/47545
        PR fortran/49050
        PR fortran/51075
        * resolve.c (resolve_fl_derived0): Print not-implemented error
        for deferred-length character components.


Modified:
    branches/gcc-4_6-branch/gcc/fortran/ChangeLog
    branches/gcc-4_6-branch/gcc/fortran/resolve.c
Comment 7 Tobias Burnus 2012-01-24 08:04:54 UTC
The ICE is fixed - but deferred-length character components are not supported: Instead of an internal compiler error, one now gets a "not yet implemented" error.

Its implementation of is now tracked at PR 51976.

*** This bug has been marked as a duplicate of bug 51976 ***