[Bug rtl-optimization/65504] [4.9/5 Regression] select case with strings and -fgcse -O
tkoenig at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Sat Mar 21 15:59:00 GMT 2015
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.
More information about the Gcc-bugs
mailing list