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

Paul Thomas <pault at gcc dot gnu.org> changed:

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

--- Comment #4 from Paul Thomas <pault at gcc dot gnu.org> ---
The problem lies in gfc_conv_expr_descriptor, as the following demonstrates:
module m1
   implicit none
   integer, parameter :: dp = kind([double precision::])
   contains
      function f(x)
         integer, intent(in) :: x
         real(dp) f(x/2)
         integer y(size(f)+1)

         write(*,*) 'size(f) = ',size(f)
         write(*,*) 'size(y) = ',my_size(y)
         f = 0
      end function f
      integer function my_size (arg)
        integer :: arg(:)
        my_size = size(arg)
      end
end module m1

program bug3
   use m1
   implicit none
   real y

   y = sum(f(2))
end program bug3

In both this and the original testcase, the result depends ultimately on a
'ubound.x' that has not been set.

I am not sure that I understand why explicit shape arrays are being handled
this way in size, when all the information needed is present in the array_spec.
However, the passing of an incorrect descriptor to 'my_size' has to be fixed.

Cheers

Paul

Reply via email to