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

            Bug ID: 103418
           Summary: random_number() does not accept pointer, intent(in)
                    array argument
           Product: gcc
           Version: 10.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: baradi09 at gmail dot com
  Target Milestone: ---

The following module is, at least according to the discussion on
fortran-lang.discourse
(https://fortran-lang.discourse.group/t/meaning-of-the-intent-for-pointer-dummy-arguments/2328/11)
is standard complying, but gfortran stops with an error message when compiling
it. Someone in that topic also posted a gcc-patch, which may fix the issue.

Code:

module m
contains
   subroutine s1(a)
      real, pointer, intent(in) :: a
      call s2(a )           !<-- Ok with gfortran
      call random_number(a) !<-- but not this
   end subroutine
   subroutine s2(x)
      real, intent(out) :: x
      call random_number(x)
   end subroutine
end module

Error message:

bug3.f90:6:25:

    6 |       call random_number(a) !<-- but not this
      |                         1
Error: ‘harvest’ argument of ‘random_number’ intrinsic at (1) cannot be
INTENT(IN)

Reply via email to