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

G. Steinmetz <gs...@t-online.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code

--- Comment #1 from G. Steinmetz <gs...@t-online.de> ---

The following variants can be compiled and work as expected :


$ cat z2.f90
module m
   implicit none
contains
   character(4) function g(k)
      integer :: k
      character(3), parameter :: a(2) = ['1  ', '123']
      g = f(k)
   contains
      function f(n)
         integer :: n
         character(len_trim(a(n))) :: f
         f = 'abc'
      end
   end
end
program p
   use m
   print *, '>>' // g(1) // '<<'
   print *, '>>' // g(2) // '<<'
end


$ cat z3.f90
module m
   implicit none
   character(3), parameter :: a(2) = ['1  ', '123']
contains
   character(4) function g(k)
      integer :: k
      g = f(k)
   contains
      function f(n)
         integer :: n
         character(len_trim(a(n))) :: f
         f = 'abc'
      end
   end
end
program p
   use m
   print *, '>>' // g(1) // '<<'
   print *, '>>' // g(2) // '<<'
end

Reply via email to