Silverfrost Forums

Welcome to our forums

Can't assign to intent(out) automatic array element.

24 Apr 2018 7:02 #21942

This bug is similar to the issue with passing automatic arrays on the other thread. A run-time error occurs on the line nn = n when /CHECKMATE or /CHECK is used with the 32 bit compiler. (v 8.3).

I have enabled /inhibit_check 14 to get around the other bug. However, it doesn't prevent the run-time error this time. Also this error also occurs when /CHECK is used. I think its a different bug so I have created a new thread.

It works fine in version 7.2.

module proc_mod

   integer :: num
   integer :: bins

contains

   subroutine run_analysis
      bins = 40
      num = 1
      call process
   end subroutine run_analysis

   subroutine process
   
      integer :: k

      ! Automatic array
      integer, dimension(bins,num) :: freq
      integer, dimension(num) :: k1

      freq = 0

      do k=1, num
         call scale_vector(freq(:,k), 100, k1(k))
      end do
   
   contains

      subroutine scale_vector(c, n, nn)
         integer, intent(in) :: n
         integer, intent(out) :: nn
         integer, intent(inout) :: c(:)
         print *,'subroutine was called'
         nn = n
         print *,'nn was defined'
      end subroutine scale_vector

   end subroutine process
   
end module proc_mod

program main

   use proc_mod, only: run_analysis

   call run_analysis

end program main
24 Apr 2018 7:34 #21943

Thanks. The same fix as before also applies to this code.

In v7.2, runtime checking was not applied when passing array sections as arguments. Runtime checking of array sections was added and worked OK in our initial tests, but in the light of your experience it has proved necessary to backtrack until we have more time to work on this.

24 Apr 2018 7:39 #21944

Quoted from PaulLaidler Thanks. The same fix as before also applies to this code.

In v7.2, runtime checking was not applied when passing array sections as arguments. Runtime checking of array sections was added and worked OK in our initial tests, but in the light of your experience it has proved necessary to backtrack until we have more time to work on this.

Thanks Paul. I understand the need to backtrack. For this one I have enabled /SUPPRESS_ARG_CHECK as a workaround.

Please login to reply.