!======================================================================= ! FILE: TEST14.F90 ! DATE: 21 July 2003 ! ! TEST: Attempt to do array arithmetic with an array, X, of ! size N and store results in array, XADD, of size N-1 ! ! Contact: This code was sent to me without an author. ! H. D. Knoble !======================================================================= module try_bounds_module implicit none public :: add contains subroutine add(x) real , dimension(:) , intent(in out) :: x real , dimension(size(x)-1) :: xadd xadd = x + 1 ! should cause error with bound checking turned on x = x + sum(xadd) return end subroutine add end module try_bounds_module program xbounds use try_bounds_module implicit none integer , parameter :: n=5 real , dimension(n) :: x x = 0.0 call add(x) write (unit=*,fmt=*) "x=",x stop end program xbounds