fortran: calculate elements of a subarray using a provided stride value
The stride value can be a positive or negative integer, but may
not be zero. If no stride is provided, use the default value
1 to print all elements inside the range.
1| program prog
2| integer :: ary(10) = (/ (i, i=1, 10) /)
3| end program prog
(gdb) print ary(1:10:2)
$3 = (1, 3, 5, 7, 9)
2013-11-27 Christoph Weinmann <christoph.t.weinmann>
* eval.c (value_f90_subarray): Add range size calculation
for stride based ranges, and evaluation of user stride
parameters. Add check for matching user input to array
bounds.
* valops.c (value_slice): Add call parameter with default
stride value for calling value_slice_1.
* valops.c (value_slice_1): Add function parameter for
stride length in the return subarray. Calculate array
elements based on stride value.
* value.h: Add stride parameter to declaration of
value_slice_1.
Signed-off-by: Christoph Weinmann <christoph.t.weinmann@intel.com>
3 files changed