[Bug fortran/48890] length of a character derived-type component with PARAMETER

fxcoudert at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sun May 3 21:32:00 GMT 2015


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

Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxcoudert at gcc dot gnu.org

--- Comment #2 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
This is indeed a wrong-code bug. It's been reported on comp.lang.fortran today:

   implicit none
   type :: a_t
      character(len=10) :: s = "x"
   end type a_t
   type(a_t), parameter :: foo = a_t("")
   type(a_t), parameter :: bar = a_t()
   print *, len(foo%s), len_trim(foo%s)
   print *, len(bar%s), len_trim(bar%s)
   end

gives

           0           0
          10           1

while it should give:

          10           0
          10           1



More information about the Gcc-bugs mailing list