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

--- Comment #1 from Gerhard Steinmetz <gerhard.steinmetz.fort...@t-online.de> 
---


A "scalar" version works :


$ cat y1.f90
program p
   call s
contains
   function f(x, y) result(z)
      character(*), intent(in) :: x, y
      character(len(x)**len(y)) :: z
      z = x // y
   end
   subroutine g(x)
      character(*), intent(in) :: x
      print *, 'inside g :', len(x), x
   end
   subroutine s
      call g( f('ab', 'xyz') )
   end
end


$ gfortran-7-20160911 y1.f90
$ a.out
 inside g :           8 abxyz


---


Case from comment 0 also works with a simpler operation like "*" :


$ cat z2.f90
program p
   call s
contains
   elemental function f(x, y) result(z)
      character(*), intent(in) :: x, y
      character(len(x)*len(y)) :: z
      z = x // y
   end
   subroutine g(x)
      character(*), intent(in) :: x(:)
      print *, 'inside g :', len(x), size(x), x
   end
   subroutine s
      call g( f(['ab'], ['xyz']) )
   end
end


$ gfortran-7-20160911 z2.f90
$ a.out
 inside g :           6           1 abxyz

$

Reply via email to