https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62044

paul.richard.thomas at gmail dot com <paul.richard.thomas at gmail dot com> 
changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |paul.richard.thomas at gmail 
dot c
                   |                            |om

--- Comment #6 from paul.richard.thomas at gmail dot com <paul.richard.thomas 
at gmail dot com> ---
(In reply to Mikael Morin from comment #4)
> Author: mikael
> Date: Sun Jan 25 20:30:53 2015
> New Revision: 220097
> 
> URL: https://gcc.gnu.org/viewcvs?rev=220097&root=gcc&view=rev
> Log:
> fortran/
>       PR fortran/62044
>       * decl.c (gfc_match_derived_decl): Don't insert a new symtree element.
>       * module.c (MOD_VERSION): Bump.
>       (write_module): Don't write list of extensions.
>       (read_module): Don't jump over list of extensions;
>       don't load list of extensions.
>       (load_derived_extensions, write_dt_extensions,
>        write_derived_extensions): Remove.
> 
> testsuite/
>       PR fortran/62044
>       * gfortran.dg/use_rename_7.f90: New.
> 
> 
> Added:
>     trunk/gcc/testsuite/gfortran.dg/use_rename_7.f90
> Modified:
>     trunk/gcc/fortran/ChangeLog
>     trunk/gcc/fortran/decl.c
>     trunk/gcc/fortran/module.c
>     trunk/gcc/testsuite/ChangeLog

Mikael,

The following, which works OK with another brand, selects the "wrong type" with
trunk. 4.9 still segfaults. Without the use rename, 4.9 runs and gives the
wrong result.

module GridImageSilo_Template
  implicit none
!  private
  type, public, abstract :: GridImageSiloTemplate
  end type GridImageSiloTemplate
end module GridImageSilo_Template

module UnstructuredGridImageSilo_Form
  use GridImageSilo_Template
  implicit none
!  private
  type, public, extends ( GridImageSiloTemplate ) :: &
    UnstructuredGridImageSiloForm
  end type UnstructuredGridImageSiloForm
end module UnstructuredGridImageSilo_Form

module UnstructuredGridImages
  use UnstructuredGridImageSilo_Form, &
        UnstructuredGridImageForm => UnstructuredGridImageSiloForm
contains
  subroutine foo
    class (GridImageSiloTemplate), allocatable :: a
    type (UnstructuredGridImageForm) :: b
    allocate (a, mold = b)
    select type (a)
      type is (UnstructuredGridImageForm)
        print *, "correct type selected"
      class default
        print *, "wrong type"
    end select
  end subroutine
end module UnstructuredGridImages

  use UnstructuredGridImages
  call foo
end

I think that it should be reopened as a placeholder. I suspect that removing
the inheritance information is not the right way to go.

Cheers

Paul

Reply via email to