This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

checking array bounds for actual arguments


Hi all,
I have a question regarding the following code sample:


program main
implicit none
real x(2),y(3),z(4)

call a(x)
call a(y)
call a(z)

contains

  subroutine a(x)
    implicit none
    real x(3)
    write(*,*) 'x=',x
  end subroutine a

end program main


For the first call of the subroutine I get this warning:

call a(x)
      1
Warning: Actual argument contains too few elements for dummy argument
'x' (2/3) at (1)

But for "call a(z)" I don't get any warning, although the shape of the
array does not match either. Is there any way to make gfortran issue a
warning for such a case? And if not, do think it would make sense to
implement such a check?
Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]