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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
   Last reconfirmed|2015-08-18 00:00:00         |2022-1-24

--- Comment #3 from anlauf at gcc dot gnu.org ---
Interestingly, when using the RESULT clause in the function declaration,
the evaluation of SIZE appears to work for:

program bug
  implicit none
  real :: u(3)
  u = f(3)
  u = g(3)
contains
  !-
  function f(n)
    integer, intent(in) :: n
    real    :: f(n)
    integer :: y(size(f))
    f = 1
    print *, 'f: size(y) =',size(y)
  end function f
  !-
  function g(n) result (f)
    integer, intent(in) :: n
    real    :: f(n)
    integer :: y(size(f))
    f = 2
    print *, 'g: size(y) =',size(y)
  end function g
end

This prints:

 f: size(y) =           0
 g: size(y) =           3

(Expecting size=3 in both cases).

Reply via email to