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

--- Comment #8 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Reduced test case:

program testbug
  implicit none
  integer, parameter :: STRLEN = 256
  type :: ncVarnames_t
    ! variables names for the different ice models
    character (len=STRLEN) :: surf
    character (len=STRLEN) :: bed
  end type ncVarnames_t

  type (ncVarnames_t) :: testvar
  type (ncVarnames_t) :: testvar2

  testvar = get_ncVarnames ("test")
  testvar2 = get_ncVarnames ("test")

  print *, trim(testvar%bed)

  contains
  type (ncVarnames_t) function get_ncVarnames (model) result (v)
    character(len=*), intent(in) :: model
    ! type (ncVarnames_t)          :: v

    select case (model)
    case ("test")
       ! test model
       v%bed = 'bed'
     case ("pism")
        ! pism data
        v%bed = 'topg'
     case default
        print *, "unknown model, please use one of [test pism sico]"
        stop
    end select
  end function get_ncVarnames
end program testbug

You need two cases in the select case statement, you need two calls to
get_ncVarnames, and you need the two components in the type.

Reply via email to